N,K = (int(i) for i in input().split())

if K == 1:
    ans = 0
else:
    ans = N - K
print(ans) int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i N,K = (int(i) for i in input().split()) N (int(i) for i in input().split()) K if K == 1:
    ans = 0
else:
    ans = N - K K == 1 K 1 ans = 0 ans 0 ans = N - K ans N - K N K print(ans) print ans K = (int(i) for i in input().split()) (int(i) for i in input().split()) K ans = 0 0 ans N,K = (int(i) for i in input().split()) (int(i) for i in input().split()) N ans = N - K N - K ans
N,K = (int(i) for i in input().split())

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