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


if K == 1:
    result = 0
else:
    result = N-K
print(str(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 = 0
else:
    result = N-K K == 1 K 1 result = 0 result 0 result = N-K result N-K N K print(str(result)) print str(result) str result K = map(int, input().split() ) map(int, input().split() ) K result = N-K N-K result result = 0 0 result result = 0 0 result N,K = map(int, input().split() ) map(int, input().split() ) N
N,K = map(int, input().split() )
result = 0


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