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

if K == 1:
    print(0)
    exit()

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

if K == 1:
    print(0)
    exit()

ans = N - K
print(ans)
