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

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

min = 1
max = N -(K-1)
if K == 1:
    print(0)
else:
    print(max-min)