#標準入力
N,K = (int(x) for x in input().split())
ans = 0
ans = N-K
if K==1:
  ans=0
print(ans)
 int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x N,K = (int(x) for x in input().split()) N (int(x) for x in input().split()) K ans = 0 ans 0 ans = N-K ans N-K N K if K==1:
  ans=0 K==1 K 1 ans=0 ans 0 print(ans) print ans ans = N-K N-K ans ans=0 0 ans N,K = (int(x) for x in input().split()) (int(x) for x in input().split()) N ans = 0 0 ans K = (int(x) for x in input().split()) (int(x) for x in input().split()) K
#標準入力
N,K = (int(x) for x in input().split())
ans = 0
ans = N-K
if K==1:
  ans=0
print(ans)

