[N,x]=list(map(int, input().split()))

if x==1:
  print(0)
else:
  print(N-x) [N,x]=list(map(int, input().split())) [N,x] N x list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split if x==1:
  print(0)
else:
  print(N-x) x==1 x 1 print(0) print 0 print(N-x) print N-x N x
[N,x]=list(map(int, input().split()))

if x==1:
  print(0)
else:
  print(N-x)