inputs = [int(s) for s in input().split()]
n = inputs[0]
k = inputs[1]

rest = n - k

if(k == 1):
    print(0)
else:
    print(rest)
 int(s) for s in input().split() for s in input().split() s input().split() ().split () input split for s in input().split() int(s) int s inputs = [int(s) for s in input().split()] inputs [int(s) for s in input().split()] n = inputs[0] n inputs[0] inputs 0 k = inputs[1] k inputs[1] inputs 1 rest = n - k rest n - k n k if(k == 1):
    print(0)
else:
    print(rest) k == 1 k 1 print(0) print 0 print(rest) print rest n = inputs[0] inputs[0] n k = inputs[1] inputs[1] k rest = n - k n - k rest inputs = [int(s) for s in input().split()] [int(s) for s in input().split()] inputs
inputs = [int(s) for s in input().split()]
n = inputs[0]
k = inputs[1]

rest = n - k

if(k == 1):
    print(0)
else:
    print(rest)

