#d2019PC2 - A
N,K=map(int,input().split())
MAX=N-K+1
print(MAX-1 if K!=1 else 0) N,K=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split K MAX=N-K+1 MAX N-K+1 N-K N K 1 print(MAX-1 if K!=1 else 0) print MAX-1 if K!=1 else 0 K!=1 K 1 MAX-1 MAX 1 0 N,K=map(int,input().split()) map(int,input().split()) N K=map(int,input().split()) map(int,input().split()) K MAX=N-K+1 N-K+1 MAX
#d2019PC2 - A
N,K=map(int,input().split())
MAX=N-K+1
print(MAX-1 if K!=1 else 0)