N, K = [int(_) for _ in input().split()]

if K == 1:
    result = 0
else:
    result = N - (K - 1) - 1

print(result) int(_) for _ in input().split() for _ in input().split() _ input().split() ().split () input split for _ in input().split() int(_) int _ N, K = [int(_) for _ in input().split()] N [int(_) for _ in input().split()] K if K == 1:
    result = 0
else:
    result = N - (K - 1) - 1 K == 1 K 1 result = 0 result 0 result = N - (K - 1) - 1 result N - (K - 1) - 1 N - (K - 1) N K - 1 K 1 1 print(result) print result N, K = [int(_) for _ in input().split()] [int(_) for _ in input().split()] N result = 0 0 result result = N - (K - 1) - 1 N - (K - 1) - 1 result K = [int(_) for _ in input().split()] [int(_) for _ in input().split()] K
N, K = [int(_) for _ in input().split()]

if K == 1:
    result = 0
else:
    result = N - (K - 1) - 1

print(result)