Vasya likes to solve equations. Today he wants to solve $(x~\mathrm{div}~k) \cdot (x \bmod k) = n$, where $\mathrm{div}$ and $\mathrm{mod}$ stand for integer division and modulo operations (refer to the Notes below for exact definition). In this equation, $k$ and $n$ are positive integer parameters, and $x$ is a positive integer unknown. If there are several solutions, Vasya wants to find the smallest possible $x$. Can you help him?


-----Input-----

The first line contains two integers $n$ and $k$ ($1 \leq n \leq 10^6$, $2 \leq k \leq 1000$).


-----Output-----

Print a single integer $x$ — the smallest positive integer solution to $(x~\mathrm{div}~k) \cdot (x \bmod k) = n$. It is guaranteed that this equation has at least one positive integer solution.


-----Examples-----
Input
6 3

Output
11

Input
1 2

Output
3

Input
4 6

Output
10



-----Note-----

The result of integer division $a~\mathrm{div}~b$ is equal to the largest integer $c$ such that $b \cdot c \leq a$. $a$ modulo $b$ (shortened $a \bmod b$) is the only integer $c$ such that $0 \leq c < b$, and $a - c$ is divisible by $b$.

In the first sample, $11~\mathrm{div}~3 = 3$ and $11 \bmod 3 = 2$. Since $3 \cdot 2 = 6$, then $x = 11$ is a solution to $(x~\mathrm{div}~3) \cdot (x \bmod 3) = 6$. One can see that $19$ is the only other positive integer solution, hence $11$ is the smallest one.

Difficulty: interview

Starter code:

Solutions:
n, k = list(map(int, input().split()))
result = 10 ** 26
for i in range(1, k):
    if n % i == 0:
        t = n // i
        result = min(result, t * k + i)
print(result)


n, k = list(map(int, input().split()))
h = k - 1
while True:
    if n % h == 0:
        break
    h -= 1
print(n // h * k + h)

n, k = list(map(int, input().split()))
import math
d = k - 1
while n % d != 0:
    d -= 1
print(n // d * k + d)


import sys, time, os
from pprint import pprint as pp
if os.environ.get('_ONPC_', False):
    stdin = open('input.txt', 'r')
    stdout = open('output.txt', 'w')
    sys.stdin = stdin
    sys.stdout = stdout

    now = time.time()
    __flag = True
else:
    __flag = False


def what(obj):
    if __flag:
        pp(obj, sys.stderr)


#############################################

n, k = map(int, input().split())
min_x = n*k + 1

for i in range(1, k):
    if n % i == 0:
        min_x = min(min_x, n//i*k + i)
print(min_x)

##############################################
if __flag:
    stdout.close()
    stdin.close()

    print(time.time() - now, file=sys.stderr)


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

    x = float('+inf')
    for r in range(1, k):
        if n % r != 0:
            continue

        q = n // r
        x = min(x, q * k + r)

    print(x)


main()


n, k = map(int, input().split())
for i in range(k - 1, 0, -1):
    if n % i == 0:
        print(k * n // i + i)
        return

n, k = map(int, input().split())
mod = k-1
while n//mod != n/mod:
    mod-=1
t = n//mod
print(t*k+mod)

n, k = map(int, input().split())
minn = 10 ** 9
for m in range(1, k):
    if n % m == 0:
        if minn > (n // m) * k + m:
            minn = (n // m) * k + m
print(minn)

a, b = list(map(int, input().split()))
ans = 100000000000
if a == 0:
    print(0)
else:    
    for i in range(1, b):
        if a % i == 0:
            ans = min(a // i * b + i, ans)
print(ans)


n, k = list(map(int, input().split()))
ans = 10**18
for i in range(1, k):
    if n % i > 0:
        continue
    mod = i
    div = n // mod
    x = div * k + mod
    if x < ans:
        ans = x
print(ans)


from math import sqrt

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

x = float("inf")

max_div = int(sqrt(n))
for div in range(1, max_div + 1):
    if n % div == 0:
        div2 = n // div
        if div2 < k:
            x = min(x, div * k + div2)
        if div < k:
            x = min(x, div2 * k + div)
print(x)

n,k=list(map(int,input().split()))
i=1
while True:
    if n%(k-i)==0:
        print(n//(k-i)*k+k-i)
        break
    i+=1



# list(map(int, input().split()))
# map(int, input().split())

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

m = 100000000000000000
for i in range(1, k):
    if n % i == 0:
        m = min(m, n // i * k + i)
print(m)

n, k = map(int, input().split())
a = []
for i in range(1, k):
    if n % i == 0:
        g = n // i
        a.append(g * k + i)
print(min(a))

n, k = map(int, input().split())
for i in range(k - 1, 0, -1):
    if n % i == 0:
        print((n // i) * k + i)
        break

n, k = (int(x) for x in input().split())
for i in range(k - 1, 0, -1):
    if (n % i == 0):
        print((n // i) * k + i)
        return

n, k = list(map(int, input().split()))
m = 10000000000000000000
for i in range(1, k):
    if n % i == 0:
        x = i + (k * (n // i))
        if m > x:
            m = x
print(m)


n, k = map(int, input().split())
ans = 2 * 10 ** 9
i = 1
while i * i <= n:
    if n % i == 0:
        if i < k:
            ans = min(ans, i + n // i * k)
        if n // i < k:
            ans = min(ans, n // i + i * k)
    i += 1
print(ans)

n, k = map(int, input().split())
mn = int(1e20)
for i in range(1, k):
    if not n % i:
        mn = min(mn, k * (n // i) + i)
print(mn)

n,k=[int(s) for s in input().split()]
for i in range(k-1,0,-1):
    if n%i==0:
        print(n//i*k+i)
        return


n,k=map(int,input().split())
q=0
w=k
while q==0 :
    w-=1
    if n%w==0 :
        q=n//w
print(q*k+w)

n,k=list(map(int,input().split()))
deli=[]

oti=1
for i in range(k-1,0,-1):
    if n%i==0:
        oti=i
        break

ans=(n//oti)*k+oti
print(ans)



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

def nearest_div(n, k):
    for i in range(k - 1, -1, -1):
        if not n % i:
            return i
i = nearest_div(n, k)   
print(k * (n // i) + i)

n, k = list(map(int, input().split()))
for i in range(k - 1, 0, -1):
    if n % i == 0:
        r = i
        break
n //= r
print(n * k + r)


n, k = map(int, input().split())
a = []
for i in range(1, min(int(n ** 0.5) + 1, k)):
    if n % i == 0:
        a.append((i, n // i))
ans = int(1e10)
for i in range(len(a)):
    if a[i][0] * k + a[i][1] < ans and a[i][1] < k:
        ans = a[i][0] * k + a[i][1]
    if a[i][1] * k + a[i][0] < ans and a[i][0] < k:
        ans = a[i][1] * k + a[i][0]
print(ans)