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

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, K):
    if K == 1:
        return 0
    return (N - K)


def main():
    N, K = read_int_n()
    print(slv(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 = 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):
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().split()))
if (K == 1):
    print(0)
else:
    print(N-K)

Solution (Python):

import sys
INF = float("inf")


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


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))  
    solve(N, K)


if __name__ == '__main__':
    main()

Solution (Python):
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq as hq
import itertools as its
import operator as op



inf = float('inf')
N = 0


def set_inputs():
    global N
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    
    n, k = get_li()
    if k == 1:
        print(0)
    else:
        print(n-k)
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


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


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input().strip()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().strip().split(sep=sep))]
        for _ in range(n)
    )))


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 = 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 >= 2 :
    a = 1
    b = N - a * (K-1)
    c = b - a
    print(c)
else : print(0)

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

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

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

nokori = N-K
if K >= 2:
    max_ = 1 + nokori
    min_ = 1
    out = max_ - min_
else:
    out = 0

print(out)

Solution (Python):

n,k = map(int,input().split())
if k ==1 or k == n:
    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())
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())
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 = [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)
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, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
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 = [int(item) for item in input().split()]
if k == 1:
    print(0)
else:
    print(n-k)

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

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(max(N - K, 0))

Solution (Python):
M, N = map(int, input().split())
ans = 0
if N == 1:
    ans = 0
else:
    ans = M - N
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)
    exit()

print(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())
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 getlist():
	return list(map(int, input().split()))

N, K = getlist()

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

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

Solution (Python):


def main():
    n, k = map(int, raw_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)
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 >= 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:
  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,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:
	s1 = n - k
	print(s1)

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,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(N-K)

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

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

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

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

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

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

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

ans = (
    N - K if K >= 2 else
    0
)

print(ans)

Solution (Python):
import sys
from collections import deque  
from collections import defaultdict  
from heapq import heapify, heappush, heappop, heappushpop  
from bisect import bisect_left, bisect_right  



s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

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

main()

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

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)
    exit()

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

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

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

Solution (Python):

import sys


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



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))  
    solve(N, K)

if __name__ == '__main__':
    main()

Solution (Python):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
Max = sys.maxsize
def l():
    return list(map(int,input().split()))
def m():
    return map(int,input().split())
def onem():
    return int(input())
def s(x):
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa == x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x):
    return " ".join(map(str,x))

n,k = m()

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):
N, H = list(map(int, input().split()))

mx = N - (H-1)
if H > 1:
    print(mx -1)
else:
    print(0)

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

Solution (Python):
import sys
from fractions import gcd
from itertools import groupby as gb
from itertools import permutations as perm
from itertools import combinations as comb
from collections import Counter as C
from collections import defaultdict as dd
sys.setrecursionlimit(10**5)
def y(f):
    if f:
        print('Yes')
    else:
        print('No')
def Y(f):
    if f:
        print('YES')
    else:
        print('NO')
def qw(f):
    if f:
        print('Yay!')
    else:
        print(':(')

n,k = map(int,input().split())
l = [0] * k
for i in range(min(n, k)):
    l[i] += 1
    n -= 1
l[0] += n
print(max(l) - min(l))

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 = 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):
a,b=map(int, input().split())
if b==1:print(0)
else:
    print(max(a-b,0))

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)
    exit()
k = N - K 
print(k)

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

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

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

Solution (Python):
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import string
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

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

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


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):
def solve(n, k):
    if k == 1:
        return 0
    else:
        u = n - (k - 1)
        return u - 1

assert solve(3, 2) == 1
assert solve(8, 5) == 3

if __name__ == '__main__':
    (n, k) = map(int, raw_input().split())
    print solve(n, k)

Solution (Python):
def solve():
    N, K = [int(_) for _ in raw_input().split()]
    if K > 1:
        ret = N - K
    else:
        ret = 0
    print ret

if __name__ == '__main__':
    solve()

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):
def inpl(): return list(map(int, input().split()))
N, K = inpl()
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+1-1)

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

Solution (Python):
import sys
def input():
    return sys.stdin.readline()[:-1]

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:
	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):
n, k = [int(i) for i in input().split()]

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

Solution (Python):
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsm = lambda: map(str, sys.stdin.readline().split())
nsl = lambda: list(nsm())

n, k = nm()
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 = 0
else :
    ans = N-K
print(ans)

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

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



def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    n, k = rli()
    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 = 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())
ans = N-K
if K == 1:
    ans = 0

print(ans)

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

Solution (Python):
import numpy as np
from collections import defaultdict
from functools import reduce




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())
a = 1
b = 1 + (n - k)
if k == 1:
    print(0)
else:
    print(b - a)

Solution (Python):
def li():
    return list(map(int, input().split()))


if __name__ == "__main__":
    [n, k] = li()
    if k == 1:
        print(0)
    else:
        print(n - k)

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

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

Solution (Python):
def getN():
    return int(input())

def getMN():
    return list(map(int, input().split()))

def getlist():
    return list(map(int, input().split()))

n,x = getlist()
if x == 1:
    print(0)
else:
    print(n-x)

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










import sys
import os
from io import IOBase, BytesIO


def main():
    n, k = get_ints()
    if k==1:
        print(0)
        return
    left = n - k
    print(left)


BUFSIZE = 8192


class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill():
            pass
        return super(FastIO, self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill()
            self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

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


class IOWrapper(IOBase):
    def __init__(self, file):
        py2 = round(0.5)
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            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")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)


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


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


def input(): return sys.stdin.readline().strip()


if __name__ == "__main__":
    main()

Solution (Python):

import sys

input=sys.stdin.readline
mii=lambda:map(int,input().split())

n,k=mii()

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

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

Solution (Python):
N, K = list(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())

print(n % k)

Solution (Python):
def solve():

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

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

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

if k >= 2:
    print(n - k)
else:
    print(0)

Solution (Python):
import sys, math, collections, heapq, itertools
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0: a, b = b, a % b
    return b
  
def solve():
    file = sys.stdin.readline 
    INF = 10 ** 25
    mod = 7 + 10 ** 9
    N, K = map(int, input().split())
    print(N % K)
    return 0
  
if __name__ == "__main__":
    solve()

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=[int(i) for i in input().split()]
print(n-k*(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):
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()))

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):
def inverse(a):
    return pow(a, mod - 2, mod)

def main():
    a,b= map(int, input().split())
    if b==1:
        print(0)
        return
    print(a-b)


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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def YesNo(x): return 'Yes' if x else 'No'
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 input()

def main():
    N, K = LI()
    ans = (N - K) if K > 1 else 0
    return ans

print(main())

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

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

def SINGLE_INT(): return int(INPUT())
def MULTIPLE_INT_LIST(): return list(map(int, INPUT().split()))
def MULTIPLE_INT_MAP(): return map(int, INPUT().split())
def SINGLE_STRING(): return INPUT()
def MULTIPLE_STRING(): return INPUT().split()

N, K = MULTIPLE_INT_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())

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

Solution (Python):
W = list(map(int,input().split()))
print(W[0]%W[1])

Solution (Python):











import sys
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
inf=float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N, K = MI()
    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 = 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:
  a = 0
else:
  a = n-k
print(a)

Solution (Python):
import sys
input = sys.stdin.readline
ri = lambda: int(input())


rl = lambda: map(int,input().split())
rr = lambda N: [list(l) for l in zip(*[rl() for _ in range(N)])]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
MOD = 10**9+7

N,K=rl()
print(N-K if K >1 else 0)

Solution (Python):

n, k = list(map(int, input().rstrip().split()))
print(n % k)

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

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

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

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


print(n%k)

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

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

Solution (Python):
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

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