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

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