Problem:
 Score : 100 points    Problem Statement Takahashi is distributing N balls to K persons.  If each person has to receive at least one ball, what is the maximum possible difference in the number of balls received between the person with the most balls and the person with the fewest balls?      Constraints  1 \leq K \leq N \leq 100  All values in input are integers.         Input Input is given from Standard Input in the following format:  N  K       Output Print the maximum possible difference in the number of balls received.        Sample Input 1 3 2      Sample Output 1 1  The only way to distribute three balls to two persons so that each of them receives at least one ball is to give one ball to one person and give two balls to the other person.  Thus, the maximum possible difference in the number of balls received is 1 .       Sample Input 2 3 1      Sample Output 2 0  We have no choice but to give three balls to the only person, in which case the difference in the number of balls received is 0 .       Sample Input 3 8 5      Sample Output 3 3  For example, if we give 1, 4, 1, 1, 1 balls to the five persons, the number of balls received between the person with the most balls and the person with the fewest balls would be 3 , which is the maximum result.

Solution (Python):
N,K = map(int,input().split())
if K == 1:
  print(0)
else:
  print(N-K)

Solution (Python):
n,k=map(int,input().split())
if k==1:
  print(0)
else:
  print(n-k)

Solution (Python):
n,k = map(int,input().split())
if k > 1:
  ans = n - k
else:
  ans = 0
print(ans)

Solution (Python):
N,K=map(int,input().split())
[print(0) if K==1 else print(N-K)]

Solution (Python):
import sys
sys.setrecursionlimit(1000000)
 
N,K = map(int,input().split())

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

Solution (Python):
n,k=map(int,input().split())
if k==1:
    print(0)
else:
    print(n-k)

Solution (Python):


from collections import deque
import itertools as ite
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

N, K = map(int, raw_input().split())
if K == 1:
	print 0
else:
	print N - K

Solution (Python):
N, K = map(int, input().split())
if K == 1:
        print(0)
else:
        print(N-K)

Solution (Python):
N,K = map(int,input().split())
if K == 1 :
  print('0')
else:
  print(N-K)

Solution (Python):
n, k = map(int, input().split())
print(0 if k == 1 else n-k)

Solution (Python):
N,K = map(int,input().split())
if K == 1:
  print("0")
else:
  print(N - K)

Solution (Python):
line = input().split()
N = int(line[0])
K = int(line[1])
 
if K==1:
  ans = 0
else:
  ans = N-K
print(ans)

Solution (Python):
N,K = map(int,input().split())
print(N%K)

Solution (Python):
N, K = [int(i) for i in input().split()]
print(N - K if K >= 2 else 0)

Solution (Python):
n,k = map(int,input().split())

print(n%k)

Solution (Python):
n,k=map(int,input().split())
print(n%k)

Solution (Python):
input_line = input().split(' ')
N = int(input_line[0])
K = int(input_line[1])

print(N%K)

Solution (Python):
N, K = map(int, input().split())
print(0 if K == 1 else N - K)

Solution (Python):
n,k = map(int,input().split())
if k==1:
  print(0)
else:
  print(n-k)

Solution (Python):
n, m = map(int,input().split())
print(n % m)

Solution (Python):
N, K = map(int, input().split())
ans = N - K
ans = ans if K != 1 else 0
print(ans)

Solution (Python):
n, k = [int(x) for x in input().split()]
if k == 1:print(0)
else:
  print( ((n - k) + 1) - 1)

Solution (Python):
n,k=map(int,input().split())
if k==1:
    print(0)
else:
    print(n-k)

Solution (Python):
n,k=map(int,input().split())
print(n-(k-1)-1 if k!=1 else 0)

Solution (Python):
n,k=map(int, input().split())

if k==1:
    print(0)
else:
    print(n-k)

Solution (Python):
n, k = map(int, input().split())
print('0' if k == 1 else n - k)

Solution (Python):

n, k = [int(i) for i in input().split()]
ans = [1 for i in range(k)]
ans[-1] += n - sum(ans)
print(max(ans) - min(ans))

Solution (Python):
n,k=map(int,input().split())
if k==1:print(0)
else:print(n-k)

Solution (Python):
n,k = map(int,input().split())
if k == 1:
    print(0)
else:
    print(n-k)

Solution (Python):
n,k = (int(x) for x in input().split())

if k == 1:
    print('0')
else:
    print(n-k)

Solution (Python):
a, b = [int(i) for i in input().split()]

print(a%b)

Solution (Python):
N,K = map(int,input().split())
if K == 1:
    print(0)
else:
    print(N-K)

Solution (Python):
n,k=map(int,input().split())
if k==1:
    print(0)
    exit()
print(n-k)

Solution (Python):
data = input()
datas = data.split(' ')

N = int(datas[0])
K = int(datas[1])

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

Solution (Python):
n, k = map(int, input().split())

if k == 1:
    print(0)
    exit()
n -= k
print (n)

Solution (Python):

N, K = map(int, input().split())

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

Solution (Python):

n,k=map(int,input().split())
if k==1:
    print(0)
else:
    print(n-k)

Solution (Python):
N,K = list(map(int,(input()).split()))
kubaru =[]
for n,k in enumerate(range(K)):

  if n+1 != K:
    kubaru.append(1)
    N-=1
  else:
    kubaru.append(N)

print(max(kubaru)-min(kubaru))

Solution (Python):
N, K = map(int, input().split())
ans = N - K if K != 1 else 0
print(ans)

Solution (Python):
n,k=map(int,input().split())
if k==1:
  print(0)
else:
  print(n-k)

Solution (Python):
n, k = map(int,input().split())
if k != 1:
  print(n-k)
else:
  print(0)

Solution (Python):
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, K] = [int(input_raw[0]), int(input_raw[1])]
    if (K == 1):
        print 0
    else:
        print (N - (K - 1)- 1)


if __name__ == '__main__':
    main()

Solution (Python):
n,k = map(int,input().split())

if k == 1:
    result = 0
else:
    result = n - k

print(result)

Solution (Python):
N, K = map(int, input().split())
if K == 1:
  print(0)
else:
  print(N - K)

Solution (Python):
import sys

def main():
    inputData = input().strip().split(" ")
    result = 0
    ball = int(inputData[0])
    people = int(inputData[1])

    if people <= 1:
        return 0

    if ball > people:
        result = ball - people
        result += 1

    else:
        return 0

    result -= 1

    return result


if __name__ == '__main__':
    print(main())

Solution (Python):

N, K = map(int, input().split())


tmp = N - K



if K == 1:
    print(0)

else:
    print(tmp)

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
MOD = 1000000007
def POW(x, y): return pow(x, y, MOD)
def INV(x, m=MOD): return pow(x, m - 2, m)
def DIV(x, y, m=MOD): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

N,K=LI()

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

Solution (Python):
n,k=map(int,input().split())
if k==1:
    print(0)
else:
    print((n-k+1)-1)

Solution (Python):
N,K = map(int,input().split())

if K == 1:
	print(0)
	exit()

minNum = 1
maxNum = N - (K-1)

print(maxNum - minNum)

Solution (Python):
inA = input().split(" ")
N = int(inA[0])
K = int(inA[1])
if(K == 1 or K == 0):
  print(0)
else:
  print((N-(K-1))-1)

Solution (Python):

n,k = map(int,input().split())

if k == 1:
    print(0)
else:
    print(n-k)

Solution (Python):
n,k = map(int,input().split())
if k == 1:
  print(0)
else:
  print(n-k)

Solution (Python):
N, K = map(int, input().split())
a = N//K
b = N-K
if K == 1:
    print(0)
else:
    print(b-a+1)

Solution (Python):
n, k = list(map(int, input().split()))
if k == 1 :
    print(0)
else :
    print(n-k)

Solution (Python):
a = [int(i) for i in input().split()]
if a[1] == 1:
  print(0)
else:
  print(a[0]-a[1])

Solution (Python):
def resolve():
    n,k=map(int,input().split())
    if k==1:
        print(0)
    else:
        print(n-k)

resolve()

Solution (Python):
n,k = map(int,input().split())
if k==1:
    ans=0
else:
    ans = n - k
print(ans)

Solution (Python):
n,k=map(int,input().split())
if k>1:
    print(n-k)
else:
    print(0)

Solution (Python):
N, K = input().split()
N = int(N)
K = int(K)

if not K == 1:
    print(N - K)

else:
    print(0)

Solution (Python):
n,k= [int(i) for i in input().split()]
if k==1:
    print (0)
else:
    print (n-k)

Solution (Python):
n,k = map(int,input().split())
ma = n-k+1
if k == 1:
    print(0)
    exit()
print(ma-1)

Solution (Python):
N, K = map(int, input().split())

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

Solution (Python):
N,K =map(int, raw_input().split(" "))


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

Solution (Python):
a,b=map(int,input().split())
c=a-b
if b!= 1:
	print(c)
else:
	print(0)

Solution (Python):
N, K = map(int, input().split())

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

Solution (Python):
n,k = map(int,input().split())
if k == 1:
    print(0)
else:
    print(n-k)

Solution (Python):
def main():
    n,k=map(int,input().split(' '))
    if k ==1:
        print(0)
    else:
        print(n-k)

if __name__=='__main__':
    main()

Solution (Python):
n, k = map(int, input().split())
if k == 1:
    print(0)
    exit()
print(n-k)

Solution (Python):
N,K =map(int,input().split())
if K==1:
    print(0)
    exit()
print(N-K)

Solution (Python):
N,K=map(int,input().split())
print(N-K if K!=1 else 0)

Solution (Python):

N, K = map(int, input().split())
if K == 1:
    print('{}'.format(0))
else:
    print('{}'.format(N-K))

Solution (Python):
a = list(map(int, input().split()))
if a[1] != 1:
    print(a[0] - a[1])
else:
    print(0)

Solution (Python):
N, K = map(int, input().split())
if K==1:
    print(0)
else:
    print(N-K)

Solution (Python):
N,K=map(int,input().split())
if K==1:
    print(0)
else:
    print(N-K)

Solution (Python):
N,K = map(int,input().split())
if(K==1):
    print(0)
else:
    print(N-K)

Solution (Python):

def solve():
    N, K = map(int, input().split())
    print(N - K if K > 1 else 0)


if __name__ == '__main__':
    solve()

Solution (Python):
N,K = map(int,input().split())
if K == 1:
  print(0)
else:
  print(N - (K - 1) - 1)

Solution (Python):
N, K = map(int, input().split())

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

Solution (Python):

import sys;
import string;
sys.setrecursionlimit(20000) 

import copy
import itertools

from functools import lru_cache


PPP = 1000000007






n, k = map(int, input().split())
print("sp", n, k, file=sys.stderr)



a = []

















import re

def doit():
  if k == 1:
    return 0
  return n - k



try:
  print(doit())
except Exception as e:
  print("e", e, file=sys.stderr)

Solution (Python):
N,K = map(int,input().split())
if K == 1:
    print(0)
else:
    print(N-(K-1)-1)

Solution (Python):
a,b = list(map(int,input().split()))
print(a%b)

Solution (Python):
n, k = list(map(int, input().split()))

if k==1:
  print(0)

else:
  print(n-k)

Solution (Python):
N, K = map(int, input().split())
if K == 1:
    print(0)
else:
    print(N - K)

Solution (Python):
n,k=map(int,input().split())
if k==1:
    print(0)
else:
    print(n-k)

Solution (Python):
a,b=map(int,input().split())
if b==1:
  print('0')
else:
  print(a-b)

Solution (Python):
N, K = map(int,input().split())

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

Solution (Python):


a,b = map(int,input().split())

def main():
    if(b==1):
        print(0)    
    else:
        print(a-b)


if __name__ == "__main__":
    main()

Solution (Python):
n,k=map(int,input().split())
if k==1:
    print(0)
else:
    n=n-k
    print(n)

Solution (Python):
import sys

readline = sys.stdin.readline

N, K = map(int, readline().split())

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

Solution (Python):
n, k = map(int, input().split())

if k == 1:
    print(0)
else:
    print(n - k)

Solution (Python):
n,k = list(map(int,input().split()))
print(n%k)

Solution (Python):
N,K=map(int,input().split())
if N==K:
  print(0)
elif K==1:
  print(0)
else:
  print(N-K)

Solution (Python):
s = list(map(int, input().split()))
if (s[1] != 1):
    ans = s[0] - s[1]
    print(ans)
else:
    print(0)

Solution (Python):

import sys
from collections.abc import Iterable
from math import *
from itertools import *
from collections import *
from functools import *
from operator import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(N: int, K: int):
    if K == 1:
        return 0

    return N - K


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    K = int(next(tokens))  
    result = solve(N, K)
    if isinstance(result, Iterable) and not isinstance(result, str):
        result = '\n'.join([str(v) for v in result])
    print(result)

if __name__ == '__main__':
    main()

Solution (Python):
balls, men = map(int,input().split())

if men == 1:
  print(0)
else:
  print(balls - men)

Solution (Python):
N,K=map(int,input().split())
if K==1:
  print(0)
else:
  print(N-K)

Solution (Python):
n,k = list(map(int, input().split()))
if(k==1):
  print(0)
else:
  print(n-k)

Solution (Python):
N, K = map(int, input().split())

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

Solution (Python):
N, K = map(int, input().split())

if K == 1 or N == K:
    print(0)
    exit(0)
print(N - K)

Solution (Python):

import sys

import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())
n, k = readmi()
if k == 1:
    print(0)
else:
    a = n - k
    print(a)

Solution (Python):
n, k = (int(i) for i in input().split()) 



 
others = k - 1  
min_num = 1
max_num = n - others
 

if k < 2:
    print(0)
else:
    print(max_num - min_num)

Solution (Python):
N, K = [int(item) for item in input().split()]
if K == 1:
  print (0)
else:
  print (N-K)

Solution (Python):
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n,k = li()

if k == 1:
    print(0)
else:
    print(n-k)

Solution (Python):
N, K = map(int,input().split())

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

Solution (Python):
N,K = map(int, input().split())
if K == 1:
    print(0)
else:
    print(N-K)

Solution (Python):
N, K = map(int, input().split())

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

Solution (Python):
a,b=map(int,input().split())
print(a-b) if b-1 else print(0)

Solution (Python):
n,k=map(int,input().split())
if n%k==0:
    print(0)
else:
    print(n%k)

Solution (Python):
N,K = map(int,input().split())
if K == 1:
    print(0)
else:
    print(N-K)

Solution (Python):
n,k = map(int,input().split())
if k == 1:
  print(0)
else:
  print(n-k)

Solution (Python):
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)

Solution (Python):
n,k=map(int,input().split())
if k==1:
    print(0)
else:
    print(n-k)

Solution (Python):
k,n = map(int,input().split())
if n == 1: print(0)
else: print(k-n)

Solution (Python):



N,K = map(int,input().split())

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

Solution (Python):
n, k = [int(v) for v in input().split()]

if k == 1:
  print(0)
else:
  print(n-k)

Solution (Python):
n,k=map(int, input().split())
if k>=2:
    ans=n-(1*k)
    print(ans)
else:
    ans=0
    print(ans)

Solution (Python):
N, K = map(int, input().split())

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

Solution (Python):
n,k=map(int,input().split())
s=n-(1*k)+1
if k==1:
  print(0)
else:
  print(s-1)

Solution (Python):
n,k = map ( int,input().split())
if k == 1 :
    print(0)
else:
    print(n-k)

Solution (Python):
N, K = map(int, input().split(" "))
print(N - K if K >= 2 else 0)

Solution (Python):
n, k = map(int,input().split())
if k == 1:
    print(0)
else:
    print(n-k)

Solution (Python):
N, K = map(int, input().split())
print(N%K)

Solution (Python):
n,k=map(int,input().split())
if k==1:
    print(0)
else:
    print(n-k)

Solution (Python):
N, K = map(int, input().split())
if K >= 2:
    print(N - K)
else:
    print(0)

Solution (Python):


import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop

def main():
    N, K = map(int, input().split())
    rest = N - K
    if K == 1:
        print(0)
    else:
        print(rest)

if __name__ == '__main__':
    main()

Solution (Python):
N, M = map(int, input().split())

if N % M == 0:
    print(0)
else :
    print(N-M)

Solution (Python):

n, k = map(int, input().split())

if k <= 1:
    ans = 0
else:
    nokori = n - k
    ans = nokori

print(ans)

Solution (Python):
N, K = map(int, input().split())
if K >= 2:
    print(N - K)
else:
    print(0)

Solution (Python):
n,k = map(int,input().split())
if k == 1:
  print('0')
else:
  print(n-k)

Solution (Python):
n,k=map(int,input().split())
if k==1:
    print("0")
else:
    print(n-k)

Solution (Python):
N, K = map(int, input().split())
if K==1:
    print(0)
else:
    print(N-K)

Solution (Python):
n,k=map(int,input().split())
if k==1:
    print(0)
else:
    print(n-k)

Solution (Python):
from sys import stdin

N, K = [int(x) for x in stdin.readline().rstrip().split()]

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

Solution (Python):
n, k = map(int,input().split())
if (k == 1):
    print(0)
else:
    print(n - k)

Solution (Python):

from collections import defaultdict
def main():
    a, b = map(int, input().split())
    if b == 1:
        print(0)
    else:
        print(a - b)






if __name__ == '__main__':
    main()

Solution (Python):
n, k = map(int, input().split())
if k == 1:
  print(0)
else:
  print(n-k)

Solution (Python):
N,K = list(map(int,input().split(' ')))
if K == 1:
    print(0)
else:
    print(N-K)

Solution (Python):
n, k = map(int, input().split())

if k == 1:
    print(0)
else:
    print(n - k)

Solution (Python):
N,K = map(int, input().split())
if K == 1:
    print(0)
else:
    print(N-K)

Solution (Python):
data = []

data.extend(list(map(int, input().split(" "))))
N = data[0]
K = data[1]

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

Solution (Python):
n,m=map(int,input().split())
if m==1:
  print(0)
else:
  print(n-m)

Solution (Python):
N,K=map(int,input().split())
if K==1:
  print(0)
else:
  print(N-K)

Solution (Python):
N,K = map(int, input().split())
if K == 1:
    print(0)
else:
    print(N-K)

Solution (Python):
n, k = input().split(' ')
n, k = int(n), int(k)
maxval = 1
if k == 1:
    print(0)
else:
    while n - maxval - k + 1 != 0:
        maxval += 1
    print(maxval - 1)

Solution (Python):
n, k = map(int, input().split())
if k == 1:
    print(0)
else:
    print(n-k)

Solution (Python):
s = input().split()

n = int(s[0])
k = int(s[1])

if k==1 :
    print(0)
else:
    print(n-k)

Solution (Python):
N, K = list(map(int, input().split()))

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

Solution (Python):

N, K = map(int, input().split())

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

Solution (Python):
n,k = [ int(x) for x in input().split() ]
if k==1: print( 0 )
else: print( n-k )

Solution (Python):
N,K = list(map(int,input().split()))
if K==1:
    ans = 0
else:
    ans = N-K
print(ans)

Solution (Python):
N, K = map(int, input().split())
print(0 if K == 1 else N - K)

Solution (Python):
N, K = map(int, input().split())
if(K == 1) :
  print(0)
else :
  max = N - K + 1
  print(max - 1)

Solution (Python):
import sys

n,k = input().split()
n,k = int(n), int(k)

if k==1 :
    print(0)
else :
    print(n-k)

Solution (Python):
n,k=map(int,input().split());print(n-k if k!=1 else 0)

Solution (Python):
n, k = (int(i) for i in input().split())

if k==1:
  dif=0
  
if k>1:
  dif=n-k
  
print(dif)

Solution (Python):
N, K = map(int, input().split())
result = 0
if K > 1:
    result = N-K

print(result)

Solution (Python):
def main():
    N, K = [int(x) for x in input().split()]

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

main()

Solution (Python):
N,K = map(int,input().split())
if K==1:
  print(0)
else:
  print(N-K)

Solution (Python):
N,K= map(int, input().split())
if K == 1:
    ans = 0
else:
    ans = N-K
print(ans)

Solution (Python):
n, k = map(int, input().split())
if k == 1:
  print(0)
else:
  print(n-k)

Solution (Python):
line = input().split()
a, b = int(line[0]), int(line[1])
print(a%b)

Solution (Python):
n,k=map(int,input().split())
print(0 if k==1 else n-k)

Solution (Python):
N, K = (int(i) for i in input().split())

if K==1:
    ans=0
else:
    ans=N-K

print(ans)

Solution (Python):
a = list(map(int, input().split()))
if a[1]==1:
    print(0)
else:
    print(a[0]-a[1])

Solution (Python):
N,K = map(int,input().split())
N -= K
if K == 1:
    print(0)
else:
    print(N)

Solution (Python):
N, K = map(int,input().split())
if K == 1:
    print(0)
else:
    print(N-K)

Solution (Python):


def gcd_core(a, b):
    if b == 0:
        return a
    else:
        return gcd_core(b, a % b)


def gcd(arr):
    g = gcd_core(arr[0], arr[1])
    for i in range(2, len(arr)):
        g = gcd_core(g, arr[i])
    return g




n,k = map(int,input().split())

if k==1:
    print(0)
else:
    print(n-k)

Solution (Python):
N, K = list(map(int, input().split()))
answer = 0 if K == 1 else N - (K - 1) - 1
print(answer)

Solution (Python):
N, K = (int(x) for x in input().split())

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

Solution (Python):
N,K = map(int, input().split())
if K == 1:
  print(0)
else:
  print(N-K)

Solution (Python):
n, k = list(map(int, input().split()))

if k != 1:
    ans = (n - (k - 1)) - 1
else:
    ans = 0
print(ans)

Solution (Python):
N, K = map(int, input().split())

if K > 1:
    remains = N - K
else:
    remains = 0

print(remains)

Solution (Python):
n,k=map(int,input().split())
if k==1:
    print(0)
else:
    print(n-k)

Solution (Python):
N, K = map(int, input().split(" "))
if K == 1:
    print(0)
    exit()
print(str(N - K))

Solution (Python):
N,K = map(int,input().split())
if K == 1:
    print(0)
else:
    print(N-K)

Solution (Python):
N, K = map(int, input().split())
if K==1 or K==0:
  print(0)
else:
  print(N-K)

Solution (Python):


"""
oj dl https://atcoder.jp/contests/abc116/tasks/abc116_d -d test-d
oj test -d test-d -c "python abc116d.py"
oj test -d test-d -c "python abc116d.py" test-d/sample-3.in
"""
from collections import defaultdict
import sys
import math
from datetime import datetime

def sol(n, k):
    if n % k == 0:
        return 0
    else:
        md = n % k
        dv = n / k
        return md



do_submit = True


def input_parse(input_str):
    lines = [x.strip() for x in input_str.split("\n") if x.strip()]
    parsed_lines = [list(map(str, line.split())) for line in lines]
    print(parsed_lines)
    n = int(parsed_lines[0][0])
    k = int(parsed_lines[0][1])
    
    
    return n, k


if not do_submit:
    n, k = input_parse("""
    3 2
    """)
    print(sol(n, k))

    n, k = input_parse("""
    3 1
    """)
    print(sol(n, k))
    n, k = input_parse("""
    8 5
    """)
    print(sol(n, k))

else:
    n, k= list(map(int, input().split()))
    
    
    
    
    print(sol(n, k))

Solution (Python):
n,k=map(int,input().split())
kk=n-k
if(k==1):
    print('0')
else:
    print(kk)

Solution (Python):
N, K = (int(i) for i in input().split())

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

Solution (Python):
N, K = map(int, input().split())

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

Solution (Python):
n, k = map(int, input().split())

if(k == 1):
    print(0)
else:
    print(n-k)

Solution (Python):
n, k = input().split()
n = int(n)
k = int(k)

if k == 1:
  print(0)
else:
  print(n-k)

Solution (Python):
N,K=map(int, input().split())

if K == 1:
  out =0
else:
  
  nokori = N - K
  mx = nokori + 1
  mn = 1
  out = mx-mn

print(out)

Solution (Python):
N, K = map(int, input().split(' '))

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

Solution (Python):
class BallDistribution:
    def __init__(self):
        self.N, self.K = map(int, input().split())

    def max_number(self):
        if self.K == 1:
            print(0)
        else:
            print(self.N - self.K)


ballDistribution = BallDistribution()
ballDistribution.max_number()

Solution (Python):
n,k = map(int,input().split(" "))
if k == 1 or n == k:
    print(0)
else:
    print(n - k)

Solution (Python):
n, k = map(int, input().split())
print(n - k if k > 1 else 0)

Solution (Python):

N,K= map(int,input().split())
if K is 1:
    print(0)
else:
    print(N- (K-1) -1)

Solution (Python):
import sys

sys.setrecursionlimit(10000)
mod = 1000000007


def mul(a, b):
    return ((a % mod) * (b % mod)) % mod


def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, y / 2) ** 2 % mod
    else:
        return power(x, y / 2) ** 2 * x % mod


def div(a, b):
    return mul(a, power(b, mod - 2))































































ans = 0

N, K = map(int, input().split())

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

Solution (Python):
N, K = [ int(x) for x in input().split() ]

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

Solution (Python):


def main():
  n, k = map(int, input().split(' '))
  if k == 1:
    print(0)
    return

  print(n - k)
  return

if __name__ == '__main__':
  main()

Solution (Python):
N, K = map(int,input().split())
print(N-K if K != 1 else 0)

Solution (Python):
N, K = input().split()
N, K = int(N), int(K)

if K==1:
  print(0)

else: print((N-(K-1))-1)

Solution (Python):
a , b = input().split()
if int(b)==1:
    print(0)
else:
    print(int(a)-int(b))

Solution (Python):
n,k=list(map(int,input().split()))
print(n-k if k>1 else 0)

Solution (Python):
N,K = [int(i) for i in input().split()]

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

Solution (Python):
N, K = map(int, input().split())

data_dict = {}

for k in range(K):
    data_dict[k] = 0

for n in range(N):
    if n in data_dict:
        if data_dict[n] == 0:
            data_dict[n] = 1
    else:
        data_dict[0] += 1

print(data_dict[0] - data_dict[K - 1])

Solution (Python):
N, K = map(int, input().split())
print(0 if K == 1 else N - K)

Solution (Python):
N,K = map(int,input().split())
if K == 1:
  print(0)
else:
  print(N-K)

Solution (Python):
import numpy as np



[N,K] = list(map(int,input().split()))
if K == 1:
    print(0)
else:
    print(N-K)

Solution (Python):
A,B=map(int,input().split())
if B==1:
  print(0)
else:
  print(A-B)

Solution (Python):
N, K = map(int, input().split())

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

Solution (Python):

N, K= map(int, input().split())
a = N - K
if K > 1:
    ans = a
else:
    ans = 0
print(ans)

Solution (Python):
N,K=map(int,input().split())
if K==1:
  a=0
else:
  a = N-K
print(a)

Solution (Python):
n,k = map(int, input().split())

if k == 1:
    print(0)
else:
    print(n-k)

Solution (Python):
N,K=list(map(int,input().split()))

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

Solution (Python):
a,b=map(int,input().split())
c=int(0)
if b==1:
    print(c)
else:
    d=a-b
    print(d)

Solution (Python):
import sys
args = sys.stdin.readlines()
tmp = [int(x) for x in args[0].split(' ')]
N, K = tmp[0], tmp[1]

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

Solution (Python):
n,k = map(int,input().split())
if k==1:
  print(0)
else:
  print(n-k)

Solution (Python):
n,k = map(int,input().split())
if k==1:
  print(0)
else:
  print(n-k)

Solution (Python):
n,k=map(int,input().split())

a=0

if k != 1:
  a=n-k
 
print(a)

Solution (Python):
n,k=map(int, input().split())
if k == 1:
    print(0)
else:
    print(n-k)

Solution (Python):
n, k = list(map(int, input().split()))
if k == 1:
    print(0)
else:
    print(n - k)

Solution (Python):
n, k = map(int, input().split())

if k == 1:
  print(0)
else:
  print(n - k)

Solution (Python):
n,k = map(int, input().split(" "))
if k == 1:
  print(0)
else:
  print(n - k)

Solution (Python):
N, K = map(int, input().split(" "))

if K == 1:
    print(0)
    exit(0)
    
    
ans = N - K
print(ans)

Solution (Python):



import sys

ball, human = list(map(int, input().split()))

if human == 1:
    print(0)
    sys.exit()
elif ball >= human:
    print(ball - human)
    sys.exit()

Solution (Python):
N, K = map(int, input().split(" "))
if K != 1:
    print(N - K)
else:
    print(0)

Solution (Python):
n,k = map(int,input().split())
if k==1:
    print(0)
else:
    print(n-k)

Solution (Python):
N, K = map(int, input().split())
if K == 1:
    print(0)
else:
    saidai = N - K + 1
    print(saidai - 1)

Solution (Python):
N,K = map(int,input().split())
if K == 1:
    print("0")
else:
    print(N-1-(K-1))

Solution (Python):
N, K = map(int, input().split())
print(N%K)

Solution (Python):
n,k = map(int,input().split())

if k == 1:
    print(0)
else:
    print(n - k)

Solution (Python):
N,K = map(int, input().split())
if K == 1:
	print(0)
else:
	print(N-K)

Solution (Python):
import sys,collections,math,random;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n,k = Is()
if k == 1 or n == k:
    print(0)
else:
    print(n-k)

Solution (Python):
N,K=map(int, input().split())
if K == 1:
  print(0)
else:
  print(N-K)

Solution (Python):
numbers = input()
numbers = numbers.split(" ")
ball_number = int(numbers[0])
person_number = int(numbers[1])

result = 0

if person_number > 1:
  result = ball_number - person_number
  
print(result)

Solution (Python):

if __name__=='__main__':
    N,K = map(int, input().split())
    if K == 1:
        print(0)
    else:
        print(N-K)

Solution (Python):
N, K = map(int, input().split())
if K == 1:
    print(0)
else:
    print(N - K)

Solution (Python):
N, K = map(int, input().split())
print(N - K) if K != 1 else print(0)

Solution (Python):
n,k = map(int, input().split())

print(0 if k==1 else n-k)

Solution (Python):
a=[]
for x in input().split(" "):
    a.append(int(x))

if a[1]==1:
    print(0)
else:
    print(a[0]-a[1])

Solution (Python):
n,m=map(int,input().split())
print(n%m)

Solution (Python):
n, k = map(int, input().split())

if k == 1:
    ans = 0
else:
    ans = n - k + 1 - 1
print(ans)

Solution (Python):
N, K = map(int, input().split())

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

Solution (Python):
n, k = map(int, input().split())
if k == 1:
    print(0)
else:
    print(n-k)

Solution (Python):
from sys import stdin

def main():
    N, K = map(int, stdin.readline().rstrip().split())

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

main()

Solution (Python):
N,K = map(int,input().split())
 
m = N-K
if K==1:
    m=0
 
print(str(m))