N,K = map(int,input().split())

print(N-K) if K != 1 else print(0)
 N,K = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split K print(N-K) if K != 1 else print(0) K != 1 K 1 print(N-K) print N-K N K print(0) print 0 K = map(int,input().split()) map(int,input().split()) K N,K = map(int,input().split()) map(int,input().split()) N
N,K = map(int,input().split())

print(N-K) if K != 1 else print(0)

