n,k = map(int,input().split())

mi = 1
ma = 1 + n-k

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

mi = 1
ma = 1 + n-k

if(k==1):
    print(0)
else:
    print(ma-mi)
