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 math
import fractions
import copy
import numpy as np

def j(q):
    if q==1: print("POSSIBLE")
    elif q == 0:print("IMPOSSIBLE")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def printrow(a):
    for i in a:
        print(i)
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)



n,m= (int(i) for i in input().split())       










if n%m==0:
    print(0)
else:
    print(n%m)

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

Solution (Python):
n, m = map(int, input().split())
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 = map(int, input().split())
print(N%K)

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

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

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

print(N%K)

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007


def A():
    n,k = LI()
    print(n%k)
    return


def B():
    n = I()

    return


def C():
    n = I()

    return


def D():
    n = I()

    return


def E():
    n = I()

    return


def F():
    n = I()

    return


def G():
    n = I()

    return


def H():
    n = I()

    return


def I_():
    n = I()

    return


def J():
    n = I()

    return


if __name__ == "__main__":
    A()