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

if K == 1:
    print('0')
else:
    print(a)

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

if K == 1:
    print('0')
else:
    print(a)


