n,k=map(int,input().split())
m=n-k+1
if k==1:
    print(0)
else:
    print(m-1) n,k=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k m=n-k+1 m n-k+1 n-k n k 1 if k==1:
    print(0)
else:
    print(m-1) k==1 k 1 print(0) print 0 print(m-1) print m-1 m 1 m=n-k+1 n-k+1 m n,k=map(int,input().split()) map(int,input().split()) n k=map(int,input().split()) map(int,input().split()) k
n,k=map(int,input().split())
m=n-k+1
if k==1:
    print(0)
else:
    print(m-1)