Problem:
 Score : 100 points    Problem Statement You are given positive integers X and Y .
If there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y , choose one such integer and print it.
If it does not exist, print -1 .      Constraints  1 ≤ X,Y ≤ 10^9  X and Y are integers.         Input Input is given from Standard Input in the following format:  X  Y       Output Print a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y , or print -1 if it does not exist.        Sample Input 1 8 6      Sample Output 1 16  For example, 16 is a multiple of 8 but not a multiple of 6 .       Sample Input 2 3 3      Sample Output 2 -1  A multiple of 3 is a multiple of 3 .

Solution (Python):
X, Y = map(int, input().split())
 
if X % Y:
    for i in range(2, 10**9):
        if X * i % Y:
            print(X * i)
            break
else:
    print(-1)

Solution (Python):

x, y = map(int, raw_input().split())

if x % y == 0:
    print(-1)
    exit()

n = 1
top = pow(10, 18)

while True:
    t = n * x
    if t >= top:
        print(-1)
        break

    if t % y != 0:
        print(t)
        break

    n += 1

Solution (Python):
x,y = [int(i) for i in input().split(" ")]

if x%y == 0:
    print(-1)
    quit()

if x==1:
    print(y*2+1)
    quit()

for i in range(x*2,10**18+1,x):
    if (i < y*2):
        continue
    elif (i%y != 0):
        print(i)
        quit()
print(-1)

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


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

else:
    for i in range(2,100000000000000000):
        if (x*(i))%y != 0:
            print(x*((i)))
            break

Solution (Python):
X, Y = list(map(int, input().split()))
if X % Y == 0:
    re = -1
elif X < Y:
    re = X
else:
    re = X * Y - X
print(re)

Solution (Python):
x, y = map(int, input().split(" "))
X = x
if x % y == 0:
    print(-1)
else:
    while X < 10 ** 18:
        if X % y != 0:
            print(X)
            exit()
        X = X + x

Solution (Python):
import sys

def main():
    X, Y = map(int, sys.stdin.readline().split())
    if X == Y:
        print(-1)
        return
    R = 1
    while True:
        R *= X
        if R >= 10**18:
            print(-1)
            return
        if R % Y != 0:
            print(R)
            return

main()

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

if x % y == 0:
    print(-1)
    sys.exit(0)
i = 2
while(True):
    v = x * i
    if v > 10 ** 18:
        print(-1)
        sys.exit(0)
    if v % y != 0:
        print(v)
        sys.exit(0)
    i += 1

Solution (Python):
X, Y = map(int, input().split())

if X % Y == 0:
    print(-1)
else:
    print(X * (Y + 1))

Solution (Python):

def main():
    x, y = map(int,input().split())

    if x % y == 0:
        print(-1)
        exit()


    i=0
    while True:
        if x * i % y == 0:
            i+=1
        else:
            print(x)
            exit()


if __name__ == "__main__":
        main()

Solution (Python):
X, Y = map(int, input().split())
if X % Y == 0:
    print(-1)
    exit()
for i in range(10**9 // X + 1):
    Xi = X * i
    if Xi % Y != 0:
        print(Xi)
        exit()
print(-1)

Solution (Python):
X, Y = map(int, raw_input().split())
if X%Y==0:
  print -1
else:
  print X

Solution (Python):
x,y=map(int,input().split())
a=x*(y-1)
if a%y==0:
  print(-1)
else:
  print(a)

Solution (Python):
x, y = map(int, input().split())
if x % y == 0:
    ans = -1
else:
    ans = x * (y - 1)
print(ans)

Solution (Python):
X, Y = list(map(int, input().split()))
if X % Y == 0:
	print(-1)
else:
	print(X * Y + X)

Solution (Python):

x, y = map(int, input().split())
for k in range(1, 100000):
    if k * x % y != 0:
        print(k * x)
        break
else:
    print(-1)

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

Solution (Python):
x, y = map(int, input().split())
if x % y == 0:
  print(-1)
else:
  print(x)

Solution (Python):
X, Y = map(int, input().split())
if X%Y==0:
    print(-1)
else:
    print(X)

Solution (Python):
x,y=map(int,input().split())
print(-1 if x%y==0 else x)

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

Solution (Python):
X, Y = map(int, input().split(' '))
if X % Y == 0: print(-1)
else:
    res = 0
    i = 1
    while res == 0:
        if X * i % Y != 0:
            res = X*i
            break
        else:
            i += 1
    if X*i <= 10**18:
        print(res)
    else:
        print(-1)

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

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

Solution (Python):
l = input().split()
l[0]=int(l[0])
l[1]=int(l[1])
MAX=int(1e+18)

if (l[0] % l[1])==0:
    print(-1)
    exit()

for i in range(1,l[1]):
    if (l[0]*i)>MAX:
        print(-1)
        exit()
    if (l[0]*i)%l[1]!=0:
        print(l[0]*i)
        exit()

Solution (Python):
x,y = map(int,input().split())
if x%y == 0:
  print(-1)
else:
  print(x)

Solution (Python):
x,y = map(int, raw_input().split())
if x % y == 0:
    print -1
else:
    print x

Solution (Python):
X,Y = map(int,input().split())

X0 = X
res = -1
if X % Y != 0:
	while True:
		if X % Y != 0:
			res = X
			break
		X *= X0

print(res)

Solution (Python):
x,y = map(int, input().split())
if x%y == 0:
    print(-1)
else:
    print(x)

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

Solution (Python):
import datetime

def getinputdata():

    
    array_result = []
    
    data = input()
    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result


arr_data = getinputdata()

x = int(arr_data[0][0])
y = int(arr_data[0][1])


cnt = 1



















if x // y >= 1 and x % y == 0:
    
    print(-1)
else:
    for i in range(x, 10 ** 18, x):

        if i % y != 0:

            print(i)
            break

    else:

        print(-1)

Solution (Python):
x, y = map(int, input().split())
print(x if x % y != 0 else -1)

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

if a%b == 0:
    print(-1)
else:
    print(a*(b-1))

Solution (Python):
x,y = map(int, input().split(" "))
if x % y == 0:
  print(-1)
else:
  print(x)

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

if a == b: 
    print(-1)
elif a < 0 or b < 0: 
    print (-1)
else:
    for i in range(1, int(10 ** 10 / a)):
        if a * i % b != 0:
            print(a * i)
            exit()
        else:
            continue
    print(-1)

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

Solution (Python):
x,y=map(int,input().split())
if x%y==0:
    print(-1)
else:
    print(x)

Solution (Python):
X, Y = map(int, input().split())
if X % Y == 0:
    print(-1)
    exit()


for i in range(1, int(1e9)):
    if X * i % Y != 0:
        print(X * i)
        exit()
print(-1)

Solution (Python):
X, Y = map(int, input().split())
if X % Y == 0:
    print(-1)
    exit()

for i in range(int(1e9), 0, -1):
    if X * i % Y != 0:
        print(X * i)
        exit()
print(-1)

Solution (Python):
x,y = map(int,input().split(' '))
if x % y == 0:
    print(-1)
else:
    print(x)

Solution (Python):
x,y=map(int,input().split())
if(x%y==0):print(-1)
else:
  i=y
  while(1):
    if((x*i)%y!=0):
      print(x*i)
      break
    i+=1

Solution (Python):
def main():
    X, Y = map(int, input().split())
    
    
    
    if X % Y == 0:
        print(-1)
        return

    ans = X * (Y - 1)
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
X, Y = map(int, input().split())
print(X if X % Y else -1)

Solution (Python):
X, Y = list(map(int, input().split()))
if X < Y:
    print(X)
elif X == Y:
    print('-1')
else:
    if X%Y == 0:
        print('-1')
    else:
        print(X)

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

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

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

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

Solution (Python):
x,y=map(int,input().split())
print([x,-1][x%y==0])

Solution (Python):
X, Y=map(int, input().split())
i=X+X
MAX=10 ** 18
 
if X%Y== 0:
    print(-1)
else:
    while i<MAX:
        if i%Y != 0:
            print(i)
            break
        i+=X

Solution (Python):
X, Y=map(int, input().split())
i=X+X
MAX=10 ** 18

if X%Y== 0:
    print(-1)
else:
    print(X)

Solution (Python):
x,y=map(int,input().split())
if x%y==0:
    print('-1')
else:
    print(x)

Solution (Python):
x, y = map(int, input().split())
print(-1 if x % y == 0 else x)

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

if a%b == 0:
    print("-1")

else:
    print(a)

Solution (Python):
from fractions import gcd

def func():
    x,y=map(int,input().split())
    if gcd(x,y) == y:
        print("-1")
    else :
        print(x)

func()

Solution (Python):
X, Y = [int(n) for n in input().split(sep=' ')]
print(X if X % Y != 0 else -1)

Solution (Python):
x, y = map(int, input().split())
i = 0
if x % y == 0:
    print(-1)
    quit()
while True:
    if x > 10**18:
        print(-1)
        quit()
    elif (x * i) % y != 0:
        print(x * i)
        quit()
    i += 1

Solution (Python):
from sys import stdin
a,b = map(int,stdin.readline().split())
if a%b:
 print a
else:
 print -1

Solution (Python):
x,y=map(int,input().split())
if(x%y==0):
	print(-1)
else:
	c=2
	a=x
	b=0
	while(a<1000000000000000000 and b==0):
		a=c*x
		if(a%y!=0):
			b=1
		else:
			c+=1	
	if(b==0):
		print(-1)
	else:
		print(a)

Solution (Python):
x, y =  map(int, input().split())
i = 1
if x % y == 0:
    print(-1)
else:
    for i in range(10 ** 18 + 1):
        if (i * x) % y != 0:
            print(i * x)
            break
        else:
            continue

Solution (Python):
nData = []
nData  = input().rstrip().split(' ')
 
X = int(nData[0])
Y = int(nData[1])

Check = X%Y
 
if Check == 0:
    print('-1')
else:
    print(X)

Solution (Python):


X, Y = map(int, input().split())

max_num = 10**18 // X


if X % Y == 0:
    print(-1)
else:
    for i in range(max_num + 1):
        if i == 0:
            continue
        else:
            if (i * X) % Y != 0:
                print(i * X)
                break
            else:
                continue

Solution (Python):
x,y = map(int,input().split(" "))
t = int(1e18)
if x < y  : 
    print(x)
else :
    if x % y == 0:
        print(-1)
    else:
        print(x * (y-1))

Solution (Python):
import math
import sys

x,y = map(int, input().split())
if x%y != 0:
    print(x)
else:
    print(-1)

Solution (Python):
import sys
sum_ = 0;
i = 2;
a, b = map(int, input().split())
if a % b == 0:
  print(-1)
  sys.exit()
while True:
    if a * i % b != 0:
        print(a * i)
        sys.exit()
    i += 1

Solution (Python):
import sys
sum_ = 0;
i = 2;
a, b = map(int, input().split())
if a % b == 0:
  print(-1)
  sys.exit()
while i < 1000000000000000000:
    if a * i % b != 0:
        print(a * i)
        sys.exit()
    i += 1

Solution (Python):
x,y = map(int,raw_input().split())
if x % y == 0:
    print -1
else:
    print x

Solution (Python):
x, y = map(int, raw_input().split())
if x % y == 0:
    print -1
else:
    print x

Solution (Python):
X, Y = map(int, raw_input().split())
if X % Y == 0:
    print -1
else:
    print X

Solution (Python):
x,y=map(int,input().split())
if x%y == 0:
    print(-1)
else:
    print(x)

Solution (Python):





x, y = [int(x) for x in input().split()]
if x%y == 0:
	print(-1)
else:
	temp = x
	while(temp%y == 0):
		temp += x
	print(temp)

Solution (Python):
x, y = map(int, raw_input().split())
print x if x % y else -1

Solution (Python):





x, y = [int(x) for x in input().split()]
if x%y == 0:
	print(-1)
else:
	temp = x
	while(temp%y == 0):
		temp += x
	print(temp)

Solution (Python):
x, y = map(int, raw_input().split())
print -1 if x % y == 0 else x

Solution (Python):
X,Y = map(int,input().split())
if X % Y == 0:
  ans = -1
else:
  ans = X
print(ans)

Solution (Python):
import itertools


def main():
    x, y = map(int, input().split())
    if x % y == 0:
        result = -1
    else:
        result = next(filter(lambda i: i % y != 0, map(lambda i: i * x, itertools.count(1))))
    print(result)


if __name__ == '__main__':
    main()

Solution (Python):
def TwoInt(x, y):
    if x % y == 0:
        return -1
    i = 2
    while (x * i) <= 1e+18:
        if (x * i) % y != 0:
            return x * i
        i += 1
    return -1

if __name__ == '__main__':
    e = input().rstrip().split(' ')
    e = [int(e[i]) for i in range(len(e))]

    print(TwoInt(e[0], e[1]))

Solution (Python):
X,Y = [int(i) for i in input().split()]
x = X
if X % Y == 0:
    print("-1")
else:
    while(True):
        x+= X
        if x%Y == 0:
            continue
        else:
            print(x)
            break

Solution (Python):
import sys

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

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

Solution (Python):
if __name__ == '__main__':
    X, Y = map(int, input().split())
    if X % Y == 0:
        print(-1)
    else:
        print(X * (Y - 1))

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

Solution (Python):

x, y = map(int, input().split())
if x%y:
    print(x)
else:
    print(-1)

Solution (Python):
X, Y = map(int, input().split())
print(X if X % Y != 0 else -1)

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

Solution (Python):
X, Y = (int(i) for i in input().split())

if X % Y == 0 :
  print(-1)
else :
  i = 2
  while i < 1000000000000000000 :
    multiples = X * i
    if multiples % Y != 0 :
      print(multiples)
      break
    else :
      i += 1

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+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 I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    x,y = LI()
    if x >= y and x % y == 0:
        return -1

    return x*y-x


print(main())

Solution (Python):
def solve():
    X, Y = list(map(int, input().split(" ")))
    if X % Y == 0:
        print(-1)
        return
    cnt = 2
    while True:
        if (X*cnt)%Y != 0:
            print(X*cnt)
            return
        cnt += 1
    return

solve()

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

if x % y == 0:
    print(-1)
else:
    while x <= 10**18:
        if x*n % y != 0:
            print(x)
            break
        n += 1

Solution (Python):
from fractions import gcd

if __name__ == "__main__":
    ins = map(int,input().split())
    a,b = list(ins)
    ans = (a*b)//gcd(a,b)
    if((ans - a) <= 0):
        print(-1)
    else:
        print(ans - a)

Solution (Python):
X,Y = map(int,input().split())

if X >= Y:
    if X % Y == 0:
        print(-1)
    else:
        print(X)
else:
    print(X)

Solution (Python):
X, Y = list(map(int, input().split()))

i = 1
while i < 10000:
  if X % Y == 0:
    print (str(-1))
    break
  else:
    ans = X * i
    if ans % Y != 0:
      print (str(ans))
      break
  i += 1

Solution (Python):
x, y = map(int, input().split())
if x % y == 0:
  result = -1
else:
  result = x

print(result)

Solution (Python):
X, Y = list(map(int,input().split()))

N = X

if X % Y == 0:
	print(-1)

else:
	while  N % Y == 0:
		N += X
	print(N)

Solution (Python):
X,Y = map(int,input().split())

if X >= Y:
    if X % Y == 0:
        print(-1)
    else:
        print(X)
else:
    print(X)

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

if x == y:
    print(-1)
else:
    for i in range(2, 11):
        if x * i % y != 0:
            print(x * i)
            break
        elif i == 10:
            print(-1)

Solution (Python):



import sys


def solve(X, Y):
    if X % Y == 0:
        return -1
    else:
        return X


def main():
    inputs = sys.stdin.readlines()
    inputs = [s.rstrip('\n').lstrip(' ') for s in inputs]

    X, Y = tuple(map(int, inputs[0].split()))

    print(solve(X, Y))


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    x, y = map(int, input().split())
    if x % y == 0:
        return print('-1')
    for i in range(1000000000):
        if (i * x) % y != 0:
            return print(i*x)
main()

Solution (Python):
X, Y = map(int, input().split())
Z = (10**18 // X) * X
if (X == Y) or (Y == 1) or (X % Y == 0):
    print(-1)
elif X < Y:
    print(X)
else:
    for i in range(Z, 0, -X):
        if i % Y != 0:
            print(i)
            break
    else:
        print(-1)

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


if x%y == 0:
     print('-1')
else:
     i = 2 
     while True:
          if x*i % y == 0:
               i += 1     
               continue
          else:
               print(x*i)
               break

Solution (Python):
xy = input()
XY = xy.split()
X = int(XY[0])
Y = int(XY[1])

a = True
i = 1

if X < Y:
    print(X)
    a = False
elif X > Y and X % Y != 0:
    while X * i <= X * Y:
        if (X * i) % Y != 0:
            print(X * i)
            a = False
            break
        else:
            i += 1
if a:
    print(-1)

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

res = -1
c = 1

while True:
    if x * c % y != 0:
        res = x * c
        break
    elif x % y == 0:
        break
    elif x * c > 10 ** 18:
        break
    c += 1

print(res)

Solution (Python):
import sys

if __name__ == "__main__":
    X, Y = map(int, (input().split(' ')))
    max = X
    min = Y
    if X < Y:
        print(X)
        sys.exit()


    if max % min == 0:
        print(-1)
        sys.exit()
    sho = (pow(10, 18) // X)  + 1
    for i in range(1, sho):
        num = X * i
        if (num % Y != 0):
            print(num)
            sys.exit()
    print(-1)

Solution (Python):
X, Y = map(int, raw_input().split( ))

i = 1
while i < 10000:
  if X % Y == 0:
    print str(-1)
    break
  else:
    ans = X * i
    if ans % Y != 0:
      print str(ans)
      break
  i += 1

Solution (Python):
X,Y=map(int,input().split())
if Y==1:
  print(-1)
elif X == 1:
  print(Y+1)
elif X%Y==0:
  print(-1)
elif Y%X==0:
  print(X*(int(Y/X)+1))
else:
  print(X)

Solution (Python):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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


if x == y:
    print(-1)
else:
    g = gcd(x, y)
    if (x * g) % y != 0:
        print(x * g)
    else:
        if x * (g + 1) % y != 0:
            print(x * (g + 1))
        else:
            print(-1)

Solution (Python):


[x, y] = list(map(int, input().split()))


if x % y == 0:
	res = -1
else:
	current = x
	while (1):
		current += x
		if (current > 10**18):
			res = -1
			break
		if (current % y != 0):
			res = current
			break
		else:
			continue

print(res)

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

Solution (Python):
import sys
x, y = map(int, raw_input().split())
if x == y:
    print -1
    sys.exit()
for i in xrange(x, x*y, x):
    if not i % y == 0:
        print i
        break
else:
    print -1

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

if a < b:
    print(a)
elif a == b:
    print(-1)
else:
    if a % b == 0:
        print(-1)
    else:
        print(a)

Solution (Python):
xy = input().split()
x, y = int(xy[0]), int(xy[1])

kakeru = 1

if x%y == 0:
    print(-1)
else:
    while True:
        kakeru += 1
        if x*kakeru%y != 0:
            break
    print(x*kakeru)

Solution (Python):
X, Y = map(int, input().split())
if X%Y == 0:
    print("-1")
else: 
    for i in range(2, int(10E18)):
        if (X*i)%Y != 0:
            print(X*i)
            break

Solution (Python):
X, Y = map(int, input().split(' '))

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

if X < Y:
    print(X)
elif X % Y == 0:
    print(-1)
elif gcd(X, Y) == 1:
    print(X)
else:
    tmp = X * gcd(X, Y)
    if tmp % Y != 0:
        print(tmp)
    else:
        print(X * int(X / gcd(X, Y)))

Solution (Python):
X, Y = map(int, input().split())
if X % Y == 0:
    print(-1)
else:
    print(X)

Solution (Python):
x,y = map(int,input().split())
if x % y == 0:
	print(-1)
	exit()
ans = 0
for i in range(y):
	ans += x
	if ans % y > 0:
		break
if ans == x*y:
	print(-1)
	exit()
print(ans)

Solution (Python):

X, Y = list(map(int, input().split()))


if X==Y or Y==1 or X%Y==0:
    print(-1)
    exit()


N = X*2
while N<=10**18:
    if N%Y!=0:
        print(N)
        exit()
    N += X


print(-1)

Solution (Python):
import sys

X,Y=map(int,input().split())
if X%Y!=0:
	i=1
	while X*i<10**18:
		if (X*i/Y)!=int(X*i/Y):
			print(X*i)
		sys.exit()
	else:
		print(-1)
else:
	print(-1)

Solution (Python):
import sys
def gcd(a, b):
        while b:
                a, b = b, a % b
        return a
def lcm(a, b):
    return a * b // gcd (a, b)

x,y = map(int, input().split())
temp = x
if x == y:
    print(-1)
    sys.exit()
while True:
    temp += x
    if temp % y != 0:
        print(temp)
        sys.exit()
    elif temp > lcm(x, y):
        print(-1)
        sys.exit()

Solution (Python):
from fractions import gcd
from math import factorial, ceil, sqrt, atan2, log, pi, e, asin,acos, cos, sin
from itertools import *
from fractions import Fraction
import string
import copy
import random
import bisect
from decimal import *
def id_generator(size=20, chars=string.digits):
    return ''.join(random.choice(chars) for _ in range(size))
 
def mp():
    return map(int,str(raw_input()).split())
 
 
a,b=mp()
if a>=b:
    if a%b==0:
    	print -1
    else:
    	print a
else:
	if 0:
		print -1
	else:
		print a

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

ans=-1
if (x % y) != 0:
	ans=x

print(ans)

Solution (Python):
x,y=map(int,input().split())
if x%y!=0:
    print(x)
else:
    print(-1)

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


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


def lcm(a, b): return a * b // gcd(a, b)


a = lcm(x, y) - x

print(-1 if a == 0 else a)

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

i = 1
x = 0

while i <= pow(10,18):
	if inp[0] == "1" and inp[1] == "1":
		print(-1)
		x = 1
		break
	if i % int(inp[0])  == 0 and i % int(inp[1]) != 0:
		print(i)
		x = 1
		break
	i *= int(inp[0])

if x == 0:
	print(-1)

Solution (Python):
x, y = map(int, raw_input().split())
print x if x % y else -1

Solution (Python):
X, Y = list(map(int, input().split()))

flag = -1
A = 0
i = 2
if X%Y != 0:
   while A <= 1e18:
      A = i * X
      i = i + 1
      if A%Y != 0:
         flag = 1
         print(A)
         break

if flag == -1:
   print(-1)

Solution (Python):
x=[int(i) for i in input().split()]


if x[0]%x[1]==0:
    print(-1)
else:
    for i in range(10000000):
        if x[0]*i%x[1]!=0:
            print(x[0]*i)
            break

Solution (Python):
X,Y=map(int, raw_input().split())
for i in range(1,10**6+1):
	if (X*i)%Y!=0:
		print X*i
		quit()
else:
	print -1

Solution (Python):
line=input().split()
x=int(line[0])
y=int(line[1])

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

Solution (Python):
X,Y=map(int,input().split())
if X==Y:
  print('-1')
elif X%Y==0:
  print('-1')
else:
  print(X)

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

t=0
for i in range(2,10**9+1):
    if a%b==0:
        break
    if a*i>=10**18:
        break
    elif a*i%b!=0:
        t=1
        break

if t==1: print(a*i)
else: print(-1)

Solution (Python):
def main():
    x,y=map(int,input().split())
    if(x%y==0):
        print(-1)
        return
    judge(x,x,y)
    
def judge(X,x,y):
    if(X % y != 0):
        print(x)
        return
    X += x
    if(X>pow(10,18)):
        print(-1)
        return
    judge(X,x,y)
        
if __name__=="__main__":
    main()

Solution (Python):





def main(input_str):
    x, y = list(map(int, input_str.split(' ')))
    if 0 == x % y:
        print(-1)
        return
    
    
    max_num = 1e18
    num = x
    while num <= max_num:
        if 0 != num % y:
            print('{}'.format(num))
            return
        num += x
    print(-1)
    
if '__main__' == __name__:
    try:
        while True:
            main(input().strip())
    except EOFError:
        pass

Solution (Python):
nData = []
nData  = input().rstrip().split(' ')

X = int(nData[0])
Y = int(nData[1])


nFlag = 0

Check = X%Y

if Check != 0:
    N = 10**18//X
    for i in range(N):
        if i<2:
            continue
        Ans = X * i
        Check = Ans%Y
        if Check !=0:
            nFlag = 1
            break
        
    
if nFlag == 0:
    print('-1')
else:
    print(Ans)

Solution (Python):
X,Y = map(int, input().split())

if X % Y == 0:
    print(-1)
else:
    print(X)

Solution (Python):
import sys

x, y = map(int, input().strip().split())

if x % y == 0:
    print(-1)
    sys.exit()

i = 1
while 1:
    z = x * i
    if z > 1.0e+18:
        print(-1)
        sys.exit()
    if z % y != 0:
        print(z)
        sys.exit()
    i += 1

Solution (Python):
x, y = map(int, input().split())
if x % y == 0:
    print("-1")
    exit()
print(x)

Solution (Python):
x,y=map(int,input().split())
if y==1:
    print('-1')
    exit()
elif x%y==0:
    print('-1')
    exit()
for i in range(x,10**18//x,x):
    if i%y!=0:
        print(i)
        break

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

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

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

Solution (Python):
import math
a,b = map(int,input().split())
if a % b == 0:
    print("-1")
else:
    k = 1
    while ( a * k ) % b == 0:
        k += 1
    print(a * k)

Solution (Python):
X, Y = map(int, raw_input().split())



count=2

num = X
flag = False

if X % Y == 0:
    print -1
else:
    while num <= 1000000000000000000 :
        num = X * count
        if (num % Y) != 0:
            
            flag = True
            break
        else:
            count = count +1

    if flag == False:
        print -1
    else:
        print num

Solution (Python):

X, Y = map(int, input().split())

if X % Y is 0:
    print(-1)
else:
    print(X)

Solution (Python):



def main():
    X, Y = map(int, input().split(' '))

    if X % Y == 0:
        print(-1)
        return

    i = 0
    A = X

    while A <= 10e18:
        if A % Y != 0:
            print(A)
            return
        else:
            i += 1
            A = (i+1)*X

    print(-1)

main()

Solution (Python):
X, Y = map(int, input().split())

if X % Y == 0:
    print('-1')
    exit()

for i in range(1, 10**18):
    if X*i % Y != 0:
        print(X*i)
        exit()

Solution (Python):
X, Y = map(int, input().split())

ans = -1

if X % Y == 0:
    pass

else:
    i = 1
    while True:
        num = X * i
        if num > 10**18:
            break
        elif num % Y != 0:
            ans = num
            break
        else:
            i += 1
print(ans)

Solution (Python):
x,y=map(int,input().split())
print(x if x%y!=0 else -1)

Solution (Python):
X,Y = map(int,input().split())
if X%Y == 0:
    print(-1)
else:
    print(X)

Solution (Python):
x,y = map(int,raw_input().split())
if x%y==0:
        print '-1'
else:
        i=2
        while x*i<10**18+1:
                if x*i%y!=0:
                        print x*i
                        break
                i=i+1

Solution (Python):
n=int(1.0e+18)
x,y=map(int,input().split(' '))
X = n//x
if x%y==0:
    print('-1')
else:
    i=2
    while i < X:
        if (x*i)%y!=0:
            print(str(x*i))
            break
        i+=1
    if i >= X:
        print('-1')

Solution (Python):
a = list(map(int, input().split()))
if a[0] % a[1] == 0:
    print(-1)
else:
    b = 1
    while b <= a[1]:
        c = a[0] * b
        if c % a[1] != 0 and c <= 10 ** 18:
            print(c)
            break
        else:
            b = b + 1
    if b == a[1] + 1 or c > 10 ** 18:
        print(-1)

Solution (Python):
temp=input()
temp=list(map(int,temp.split(" ")))
a=temp[0]
b=temp[1]
if a%b==0:
    print("-1")
else:
    for i in range(1000000000):
        if i*a%b!=0:
            print(a*i)
            exit()

Solution (Python):





x, y = [int(x) for x in input().split()]
if x == y or y == 1 or x%y == 0:
	print(-1)
else:
	temp = x
	while(temp%y == 0):
		temp += x
	print(temp)

Solution (Python):
X, Y = map(int, input().split())

if X % Y == 0:
    print('-1')
else:
    print(X)

Solution (Python):
a = list(map(int,input().split(" ")))
X = a[0]
Y = a[1]

if X%Y==0:
    print(-1)
else:
    for i in range(X*2,10**18,X):
        if i%Y!=0:
            print(i)
            break

Solution (Python):

def inpl(): return tuple(map(int, input().split()))
from math import sqrt
from bisect import bisect


def primes2(n):
    """ Input n>=6, Returns a list of primes, 2 <= p < n """
    n, correction = n-n%6+6, 2-(n%6>1)
    sieve = [True] * (n//3)
    for i in range(1,int(n**0.5)//3+1):
      if sieve[i]:
        k=3*i+1|1
        sieve[      k*k//3      ::2*k] = [False] * ((n//6-k*k//6-1)//k+1)
        sieve[k*(k-2*(i&1)+4)//3::2*k] = [False] * ((n//6-k*(k-2*(i&1)+4)//6-1)//k+1)
    return [2,3] + [3*i+1|1 for i in range(1,n//3-correction) if sieve[i]]

X, Y = inpl()

P = primes2(2*int(sqrt(10**9)))

if X%Y == 0:
    print(-1)
else:
    for p in P:
        if Y%p != 0:
            print(X*p)
            break

Solution (Python):

line = input().split(" ")
x = int(line[0])
y = int(line[1])

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

Solution (Python):
x,y=map(int,input().split())
print(-1 if x%y==0 else x*(y-1))

Solution (Python):
X,Y = map(int,input().split(" "))
if Y == 1:
	print(-1)
	exit(0)

if X < Y:
	print(X)
	exit(0)

if X % Y == 0:
	print(-1)
else:
	print(X)

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

if a % b == 0:
    print("-1")
else:
    print(a)

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

Solution (Python):
def LI(): return list(map(int, input().split()))
def LS(): return input().split()
def I(): return int(input())
def S(): return input()

x, y = LI()


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

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

if (x % y ==0):
   print -1
else:
   x0=x
   while x0<10**19:
      x0=x0+x
      if (x0 % y <>0):
         print x0
         break

Solution (Python):
import math
import itertools
import heapq
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect, bisect_left, bisect_right
from collections import defaultdict, deque








def LM(t, r): return list(map(t, r))
def R(): return stdin.readline()
def RS(): return R().split()
def I(): return int(R())
def F(): return float(R())
def LI(): return LM(int,RS())
def LF(): return LM(float,RS())
def ONE_SL(): return list(input())
def ONE_IL(): return LM(int, ONE_SL())
def ALL_IL(): return LM(int,stdin)


def ap(f): return f.append
def pll(li): print('\n'.join(LM(str,li)))
def pljoin(li, s): print(s.join(li))





def main():
	x,y = LI()
	if x%y == 0:
		print(-1)
	else:
		print(x)


if __name__ == '__main__':
    main()