N, K = map(int, input().split())
result = 0
if K > 1:
    result = N-K

print(result) N, K = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split K result = 0 result 0 if K > 1:
    result = N-K K > 1 K 1 result = N-K result N-K N K print(result) print result result = N-K N-K result result = 0 0 result K = map(int, input().split()) map(int, input().split()) K N, K = map(int, input().split()) map(int, input().split()) N
N, K = map(int, input().split())
result = 0
if K > 1:
    result = N-K

print(result)