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

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

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