x = input().split()
n = int(x[0])
k = int(x[1])

if k == 1:
    print("0")

else:
    print(n - k) x = input().split() x input().split() ().split () input split n = int(x[0]) n int(x[0]) int x[0] x 0 k = int(x[1]) k int(x[1]) int x[1] x 1 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[1]) int(x[1]) k n = int(x[0]) int(x[0]) n x = input().split() input().split() x
x = input().split()
n = int(x[0])
k = int(x[1])

if k == 1:
    print("0")

else:
    print(n - k)
