import numpy as np

a = input().split(" ")
N = int(a[0])
K = int(a[1])

if K == 1:
    print(0)
else:
    print(N-K) import numpy as np numpy a = input().split(" ") a input().split(" ") ().split () input split " " N = int(a[0]) N int(a[0]) int a[0] a 0 K = int(a[1]) K int(a[1]) int a[1] a 1 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 = int(a[0]) int(a[0]) N K = int(a[1]) int(a[1]) K a = input().split(" ") input().split(" ") a
import numpy as np

a = input().split(" ")
N = int(a[0])
K = int(a[1])

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