x,y=map(int,input().split())
if y == 1:
  print(0)
else:
  print(x-y) x,y=map(int,input().split()) x map(int,input().split()) map int input().split() ().split () input split y if y == 1:
  print(0)
else:
  print(x-y) y == 1 y 1 print(0) print 0 print(x-y) print x-y x y x,y=map(int,input().split()) map(int,input().split()) x y=map(int,input().split()) map(int,input().split()) y
x,y=map(int,input().split())
if y == 1:
  print(0)
else:
  print(x-y)
