a,b=[int(i) for i in input().split()]
if b==1:
  print(0)
else:
  print(a-b) 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 a,b=[int(i) for i in input().split()] a [int(i) for i in input().split()] b if b==1:
  print(0)
else:
  print(a-b) b==1 b 1 print(0) print 0 print(a-b) print a-b a b a,b=[int(i) for i in input().split()] [int(i) for i in input().split()] a b=[int(i) for i in input().split()] [int(i) for i in input().split()] b
a,b=[int(i) for i in input().split()]
if b==1:
  print(0)
else:
  print(a-b)
