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):

"""
Created on Sat Apr 20 20:47:47 2019

@author: Owner
"""

import numpy as np
import sys
import collections
import scipy.misc
import math
from operator import itemgetter
import itertools
import copy
import bisect


def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   

def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []
    
def getNearestValueIndex(list, num):
    """
    概要: リストからある値に最も近い値のインデックスを取得する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    
    idx = np.abs(np.asarray(list) - num).argmin()
    return idx

def find_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        """
        x が属するグループを探索
        """
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        """
        x と y のグループを結合
        """
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        """
        x と y が同じグループか否か
        """
        return self.find(x) == self.find(y)

    def get_size(self, x):
        """
        x が属するグループの要素数
        """
        x = self.find(x)
        return self.size[x]
    

"""
N, X = map(int, input().split())

x = list(map(int, input().split()))

P = [0]*N
Y = [0]*N
for n in range(N):
    P[n], Y[n] = map(int, input().split())


dp = np.zeros((N+1, 4,4,4))
    
all(nstr.count(c) for c in '753')


ABT = zip(A, B, totAB)
result = 0

sorted(ABT,key=itemgetter(2))
A, B, totAB = zip(*ABT)
A.sort(reverse=True)


(x >> i) & 1


dp = [np.inf]*N
for n in range(N):
    if n == 0:
        dp[n] = 0
    else:
        for k in range(1,K+1):
            if n-k >= 0:
                dp[n] = min(dp[n], dp[n-k] + abs(h[n]-h[n-k]))
            else:
                break

add = 1 
res = 0
sums = [0]*(len(nums)+1)
for i in range(len(nums)):
    sums[i+1] = sums[i] + nums[i]
for i in range(0, len(nums), 2):
    left = i
    right = min(i+add, len(nums))
    tmp = sums[right] - sums[left]
    res = max(tmp, res)


li, ri = bisect.bisect_left(p_ac, l[i]-1), bisect.bisect_right(p_ac, r[i]-1)    


org_list = [3, 1, 4, 5, 2]
new_list = sorted(org_list)
print(org_list)
print(new_list)




    for h in range(0,H):
        for w in range(0,W):
            if h == 0 and w == 0:
                pass
            elif h == 0:
                D[H-h-1][W-w-1]= min(D[H-h-1][W-w-1], D[H-h-1][W-w]+1)
            elif w == 0:   
                D[H-h-1][W-w-1]= min(D[H-h-1][W-w-1], D[H-h][W-w-1]+1)
            else:
                D[H-h-1][W-w-1]= min(D[H-h-1][W-w-1], D[H-h][W-w-1]+1, D[H-h-1][W-w]+1, D[H-h][W-w]+2)
            d_max = max(D[H-h-1][W-w-1], d_max)

"""



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

    
if __name__ == '__main__':
    main()

Solution (Python):
import sys

N, K = map(int, input().split())
if K == 1:
    print(0)
    sys.exit()
if N < K:
    print(1)
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(' '))

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(100000)

def intinput(): return map(int,sys.stdin.readline().split())


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

Solution (Python):
import sys
range = xrange
input = raw_input

n,k = [int(x) for x in input().split()]

n -= k

if k<=1:
    print 0
else:
    print n

Solution (Python):
import sys

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

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

print(N-K)

Solution (Python):
import bisect
from operator import itemgetter
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,K = IL()
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
stdin = sys.stdin
sys.setrecursionlimit(10**6)
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,k = na()

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

Solution (Python):
n,k = map(int,input().split())
flag = 0
if k == 1:
        flag = 1
else:
        n = n - k
if flag == 0:
        print(n)
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(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):
a,b=input().split()
a=int(a)
b=int(b)
x=a-b
if b==1:
    print(0)
else:
    print(x)

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

ans = 0

if b == 1:
    ans = 0
else:
    i = a - b
    ans = i


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 = [int(a) for a in input().split()]

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


if __name__ == '__main__':
    main()

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

Solution (Python):

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

ans = 0
if not k == 1:
   ans = n-k 

print(ans)

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

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 * 1)

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

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

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

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:
    ans = 0
else:
    ans = n-k

print(ans)

Solution (Python):
import sys

inf = 10 ** 18

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

if K < 2:
    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())

if(K==1):
    print(int(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 __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

import random
import collections
import math
import itertools

def real_main():
    b, ppl = read_int_array()
    if ppl == 1:
        print(0)
    else:
        print(b - ppl)

def main():
    if False and 'PYCHARM_HOSTED' in os.environ:
        main_pycharm()
    else:
        real_main()


from copy import deepcopy
def main_pycharm():
    solution = solve

    test_inputs = None
    test_outputs = None
    judge = None
    slow_solution = None
    if solution is not None:
        if test_outputs is not None:
            test_with_answers(solution, test_inputs, test_outputs)
        if judge is not None:
            test_with_judge(solution, test_inputs, judge)
        if slow_solution is not None:
            test_with_slow_solution(solution, test_inputs, slow_solution)


def test_with_answers(solution, inputs_answers):
    total, wrong = 0, 0
    for args, test_ans in inputs_answers:
        ans = solution(*args.copy())
        if ans != test_ans:
            print('WRONG! ans=%s, test_ans=%s, args=%s' % (ans, test_ans, args))
            wrong += 1
        else:
            print('GOOD')
        total += 1
    print('ALL %d TESTS PASSED' % total if not wrong else '%d out of %d tests are WRONG' % (wrong, total))


def test_with_judge(solution, inputs_gen, judge):
    total, wrong = 0, 0
    for args in inputs_gen:
        ans = solution(*deepcopy(args))
        if not judge(deepcopy(ans), *deepcopy(args)):
            print('WRONG! ans=%s, args=%s' % (ans, args))
            wrong += 1
        total += 1
    print('ALL %d TESTS PASSED' % total if not wrong else '%d out of %d tests are WRONG' % (wrong, total))


def test_with_slow_solution(solution, inputs_gen, solution_slow):
    total, wrong = 0, 0
    for args in inputs_gen:
        ans = solution(*deepcopy(args))
        slow = solution_slow(*deepcopy(args))
        if ans != slow:
            print('WRONG! ans=%s, slow=%s, args=%s' % (ans, slow, args))
            wrong += 1
        total += 1
    print('ALL %d TESTS PASSED' % total if not wrong else '%d out of %d tests are WRONG' % (wrong, total))




BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

read = input
read_int = lambda: int(input())
read_array = lambda sep=None, maxsplit=-1: input().split(sep, maxsplit)
read_int_array = lambda: [int(a) for a in read_array()]



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 = map(int, input().split())
print(n-(k-1) - n // k)

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

Solution (Python):
from sys import stdin
import math
import fractions
from collections import deque
import itertools

INF = 10 ** 10

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

amari = N - K

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

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):

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

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

Solution (Python):
n, k = map(int, input().split())
l = [1]*k
n -= sum(l)
l[0] += n
print(max(l)-min(l))

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

ans = N - K
if K == 1:
    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())

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

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

Solution (Python):

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

n = int(n)
k = int(k)

i  = n - k
max = i + 1
min = 1

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

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

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

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

Solution (Python):
def solve(n, k):
    if k == 1:
        return 0
    return n - k

n, k = map(int, input().split(' '))
print(solve(n, k))

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

Solution (Python):
inp = input()
split_input = inp.split()
k = int(split_input[0])
n = int(split_input[1])
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):

"""
Created on Sat Jun 15 20:53:16 2019

@author: Yamazaki Kenichi
"""

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

ans = N - K
if K == 1:
    print(0)
else:
    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):
n,k = map(int,input().split())
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):


def read_input():
    n, k = map(int, input().split())
    return n, k


def submit():
    n, k = read_input()

    balls = [1] * k
    balls[0] += (n - k)

    print(max(balls) - min(balls))
    return


if __name__ == '__main__':
    submit()

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(n-k)
else:
    print(0)

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())
a = [1] * (K-1) + [N-(K-1)]
print(max(a)-min(a))

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

Solution (Python):

import copy
import random
import bisect 
import fractions 
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) 


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())
print(0 if K == 1 else 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())
left = N-(K-1)
if K == 1:
    print(0)
else:
    print(left-1)

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

ans = n-k

if k == 1:
  ans = 0
print(ans)

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

if 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=list(map(int,input().strip().split(' ')))
if K==1:
    print(0)
else:
    print(N-K)

Solution (Python):

import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())


N, K = mi()
rest = N - K
print(rest 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())

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

Solution (Python):
n,k=map(int,input().split())
if n-k>=0 and 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())

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

re = N - K
print(re)

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

Solution (Python):




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


if __name__ == "__main__":
    main()

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

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

Solution (Python):

def solve():
    N, K  = map(int, input().split())
    if K == 1:
        return '0'
    else:
        return str(N-K)

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

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

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

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):
def main():
    N, K = map(int, input().split())
    print(N - K + 1 - 1 if K != 1 else 0)
    return


if __name__ == '__main__':
    main()

Solution (Python):



import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

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

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

Solution (Python):
N,K = [int(i) for i in 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 = list(map(int,input().split(" ")))
if K == 1:
    print(0)
else:
    nokori = N - K
    print(nokori)

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

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

Solution (Python):


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N,K=MAP()

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 0)

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(0)
    exit()
elif n<k:
    print(1)
    exit()
print(n-k)

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

Solution (Python):
from sys import stdin

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

input = lambda: stdin.readline()
main()

Solution (Python):

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

Solution (Python):
N, K = [int(x) for x in input().split()]
print(0 if K == 1 else 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(0)
else:
    print(N - K)

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

if k==1:
    print(0)
else:
    print(abs(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):

import time
import re
import math

def main():
    n,k=map(int,input().split())

    print(n%k)


start=time.time()
main()

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

ans = n - k

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

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

def main(): 
    N, K = LI()
    if K == 1: print(0)
    else: print(N-K)

main()

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

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

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

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

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

Solution (Python):


from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict
import math


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def mod_inv(x):
    
    global mod
    return pow(x, mod - 2, mod)


def gcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    ret = math.factorial(x)
    ret = ret // (math.factorial(x - y) * math.factorial(y))

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


class UnionFind:

    def __init__(self, n):
        self.parent = [i for i in range(n)]

    def root(self, i):
        if self.parent[i] == i:
            return i
        self.parent[i] = self.root(self.parent[i])
        return self.parent[i]

    def unite(self, i, j):
        rooti = self.root(i)
        rootj = self.root(j)
        if rooti == rootj:
            return
        if rooti < rootj:
            self.parent[rootj] = rooti
        else:
            self.parent[rooti] = rootj

    def same(self, i, j):
        return self.root(i) == self.root(j)





def main():
    n, k = intina()

    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)
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 = int(n)
k = int(k)

x_min = 1
x_max = n - (k-1)

if k > 1:
    print(x_max - x_min)
else:
    print(0)

Solution (Python):

"""
AtCoder A
"""

import sys, math, random
import numpy as np








inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LLS(): return [list(sys.stdin.readline().rstrip()) for _ in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()



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

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

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

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

Solution (Python):
lista = input().split(" ")
a, b= lista
a = int(a)
b = int(b)
c = a%b
print(c)

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)
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 0)

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

Solution (Python):
x,y = map(int,input().split())

if(y==1):
  print(0)
else:
  print(x-y)

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

Solution (Python):

import sys


def main():
    
    N, K = map(int, input().split())
    ans = 0

    if K == 1:
        ans = 0
    elif K > 1:
        ans = N - K
    print(ans)
    return


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 = map(int, input().split())
print(n - k 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, M = map(int, input().strip().split())

r = N-M
if r > M:
    print(0)
else:
    print(r)

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

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

Solution (Python):
N, K = list(map(int, input().split()))
if (N-K) < 0 or 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:
    print(0)
else:
    print(N - K)

Solution (Python):
import sys
from operator import itemgetter
from collections import deque

input = sys.stdin.readline

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(i) for i in 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("{}".format(ans))

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