N, K = [int(_) for _ in input().split()]

if K == 1:
    print(0)
else:
    print(N-K) int(_) for _ in input().split() for _ in input().split() _ input().split() ().split () input split for _ in input().split() int(_) int _ N, K = [int(_) for _ in input().split()] N [int(_) for _ in input().split()] K if K == 1:
    print(0)
else:
    print(N-K) K == 1 K 1 print(0) print 0 print(N-K) print N-K N K N, K = [int(_) for _ in input().split()] [int(_) for _ in input().split()] N K = [int(_) for _ in input().split()] [int(_) for _ in input().split()] K
N, K = [int(_) for _ in input().split()]

if K == 1:
    print(0)
else:
    print(N-K)
