s = list(map(int, input().split()))
if (s[1] != 1):
    ans = s[0] - s[1]
    print(ans)
else:
    print(0) s = list(map(int, input().split())) s list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split if (s[1] != 1):
    ans = s[0] - s[1]
    print(ans)
else:
    print(0) s[1] != 1 s[1] s 1 1 ans = s[0] - s[1] ans s[0] - s[1] s[0] s 0 s[1] s 1 print(ans) print ans print(0) print 0 ans = s[0] - s[1] s[0] - s[1] ans s = list(map(int, input().split())) list(map(int, input().split())) s
s = list(map(int, input().split()))
if (s[1] != 1):
    ans = s[0] - s[1]
    print(ans)
else:
    print(0)