import sys
n, k = [int(i) for i in sys.stdin.readline().split()]
if k == 1:
  print(0)
else:
  print(n - k) import sys sys int(i) for i in sys.stdin.readline().split() for i in sys.stdin.readline().split() i sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for i in sys.stdin.readline().split() int(i) int i n, k = [int(i) for i in sys.stdin.readline().split()] n [int(i) for i in sys.stdin.readline().split()] k if k == 1:
  print(0)
else:
  print(n - k) k == 1 k 1 print(0) print 0 print(n - k) print n - k n k n, k = [int(i) for i in sys.stdin.readline().split()] [int(i) for i in sys.stdin.readline().split()] n k = [int(i) for i in sys.stdin.readline().split()] [int(i) for i in sys.stdin.readline().split()] k
import sys
n, k = [int(i) for i in sys.stdin.readline().split()]
if k == 1:
  print(0)
else:
  print(n - k)