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 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()) (int(x) for x in input().split()) n
n,k = (int(x) for x in input().split())

if k == 1:
    print('0')
else:
    print(n-k)
