N, K = (int(x) for x in input().split())

if (K == 1):
    print("0")
else:
    print(N - K) int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x N, K = (int(x) for x in input().split()) N (int(x) for x 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(x) for x in input().split()) (int(x) for x in input().split()) N K = (int(x) for x in input().split()) (int(x) for x in input().split()) K
N, K = (int(x) for x in input().split())

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