import sys

n, k = [int(i) for i in input().split()]

if k == 1:
    print(0)
    sys.exit()

ans = n - k
print(ans) import sys sys 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:
    print(0)
    sys.exit() k == 1 k 1 print(0) print 0 sys.exit() sys.exit sys exit ans = n - k ans n - k n k print(ans) print ans ans = n - k n - k ans k = [int(i) for i in input().split()] [int(i) for i in input().split()] k n, k = [int(i) for i in input().split()] [int(i) for i in input().split()] n
import sys

n, k = [int(i) for i in input().split()]

if k == 1:
    print(0)
    sys.exit()

ans = n - k
print(ans)
