n, k = input().split()
n = int(n)
k = int(k)

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

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