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):
import sys
input = sys.stdin.readline

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

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

    if x < x * (y//gcd(x, y)):
        print(x)
    else:
        print(-1)
    


if __name__ == "__main__":
    main()

Solution (Python):
import fractions as math
X,Y = [int(x) for x in input().split()]
lcm = X*Y//math.gcd(X,Y)
if(lcm==X):
    print(-1)
else:
    print(X)

Solution (Python):
import sys
sys.setrecursionlimit(5 * 10**5)
input = sys.stdin.readline

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

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

Solution (Python):
x,y=map(int,input().split());print(-(x%y==0)or x)

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


if __name__ == "__main__":
    resolve()

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

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):
def gcd(a, b):
    """a, bの最大公約数(greatest common divisor:GCD)を求める"""
    if b == 0:
        return a
    return gcd(b, a%b)


a, b = map(int,input().split())
gcd_ab = gcd(a, b)
if gcd_ab == b:
    print(-1)
else:
    if a % b == 0:
        print(a*gcd_ab)
    else:
        print(a)

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

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

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

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

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

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

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

Solution (Python):
from fractions import gcd

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

i=1

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

if Y//gcd(X,Y)==1:
    print(-1)
else:
    print((X*(Y//gcd(X,Y)-1)))

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

Solution (Python):
from sys import stdin

def solve() :
    X,Y = [int(x) for x in stdin.readline().rstrip().split()]

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

solve();

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

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

Solution (Python):
def main():

    X, Y = map(int, input().split())
    if X % Y == 0: return -1
    return X*(Y-1)

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

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    x, y = list(map(int, input().rstrip('\n').split()))
    if x % y == 0:
        print(-1)
    else:
        print(x)


if __name__ == '__main__':
    slove()

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

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

Solution (Python):



import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

Solution (Python):
X,Y=map(int,input().split());print(X*~-Y*(X%Y>0)or-1)

Solution (Python):
x,y=map(int,input().split())
if x%y:
  print(x)
else:
  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())
ans = (Y - 1) * X
if ans % Y == 0:
    print(-1)
else:
    print(ans)

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

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

Solution (Python):



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

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


if __name__ == '__main__':
    main()

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

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

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(X if X%Y!=0 else -1)

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

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

Solution (Python):
import sys
x,y=map(int,input().split())
k=0
if x%y==0 or x*(y-1)>10**18:
    print(-1)
else:
    print(x*(y-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:
  for i in range(2, 10**4):
    if (i * x) % y != 0:
      print(i * x)
      exit()
  print(-1)

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())
if X % Y == 0:
    print(-1)
else:
    print(X)

Solution (Python):
x, y = [ int(v) for v in 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,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())
if x%y==0:
	print(-1)
else:
	print(x*(y-1))

Solution (Python):

import sys, math, fractions, itertools


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



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  
    Y = int(next(tokens))  
    solve(X, Y)

if __name__ == '__main__':
    main()

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(x)
else:
  print(-1)

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

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

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:
  print(-1)
  exit()

if y == 1:
  print(-1)
  exit()

for i in range(1, y):
  temp = x * i
  if temp <= 10 ** 18 and temp % y != 0:
    print(x*i)
    exit()

print(-1)

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

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

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


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

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

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

if x % y == 0:
    print(-1)
else:
    for i in range(x,1000000000000000000,x):
        if i % y !=0:
            print(i)
            break

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

main()

Solution (Python):
X, Y = [int(i) for i in 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*3 if (x*2)%y==0 else x*2)

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(x if x % y else -1)

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

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

Solution (Python):

import itertools
X = [int(el) for el in input().split(' ')]

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

Solution (Python):
a = input().split(' ')
X = int(a[0])
Y = int(a[1])
if X%Y==0:print(-1)
else :print(X)

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

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

if X % Y:
	print(X)
else:
	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:
  print(X)

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

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

Solution (Python):
def solve(x, y):
    for k in range(1, 1000):
        r = k * x
        if r % y != 0:
            return r
    return -1
x, y = map(int, input().split())
print(solve(x, y))

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

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

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


if __name__ == "__main__":
    main()

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

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

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

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

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

Solution (Python):
x,y=map(int,input().split());print(-1 if x%y==0 else 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=(int(i) for i in 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(i) for i in input().split()]
if x % y == 0:
    print(-1)
else:
    i = 2
    while True:
        if i * x % y != 0:
            print(i * x)
            break
        i += 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==0:
    print(-1)
else:
    print(x*(y+1))

Solution (Python):
x,y = map(int,input().split())
import fractions
g = fractions.gcd(x,y)
if x == y:
    print(-1)
elif y == 1:
    print(-1)
elif x > y and y == g:
    print(-1)
elif x < y:
    print(x)
elif 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):
def abc():
    x, y = map(int, input().rstrip().split())
    if x % y == 0:
        print(-1)
        return
    print(x)


abc()

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(x if x%y!=0 else -1)

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

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

Solution (Python):

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

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

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

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

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

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

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

Solution (Python):

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


X, Y = mi()

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

Solution (Python):

"""
A - Two Integers
https://atcoder.jp/contests/apc001/tasks/apc001_a

"""
import sys


def solve(X, Y):
    t = X / Y
    if t.is_integer():
        return -1
    return X


def main(args):
    X, Y = map(int, input().split())
    ans = solve(X, Y)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

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

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

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

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

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

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

print(X)

Solution (Python):
l = list(map(int,input().split()))
A = l[0];
B = l[1];

if(A%B == 0):
    print(-1)
else:
    xa = A*2;

    while ((xa%B == 0) and (xa < 10**18)):
        xa += A;

    if(xa > 10**18):
        print(-1);
    else:
        print(xa);

Solution (Python):
from sys import exit, stdin
X, Y = [int(_) for _ in stdin.readline().rstrip().split()]
for i in range(1, 11):
    if X*i % Y != 0:
        print(X*i)
        exit()
print(-1)

Solution (Python):
X, Y = [int(x) for x in input().split()]

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

    for x in range(X, 10**18+1, X):
        if x % Y != 0:
            return x
print(solve(X, Y))

Solution (Python):
import fractions
x,y=map(int,input().split())
a=x*y/fractions.gcd(x,y)
a-=x
if a>0 and a<10**19:
     print(int(a))
else:
     print(-1)

Solution (Python):

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

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

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

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

def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x%y)

g = Y / gcd(X, Y)

if g == 1:
  print("-1")
else:
  if g == 2:
    g = 3
  else:
    g = 2
  ans = X * g
  if ans <= 1e18:
    print(ans)
  else:
    print("-1")

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

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 = map(int,input().split())
for i in range(1,10**6):
    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:
  print(X)

Solution (Python):

x,y = map(int,input().split())
if x % y  == 0 or x > 10**18:
	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=map(int,input().split())
if x//y>=1 and x%y==0:
    print(-1)
    exit()
a=x*(y-1)
b=x*(y+1)
t=1000000000000000000
if a>0 and a%y and a<=t:
    print(a)
elif b>0 and b%y and b<=t:
    print(b)
else:
    print(-1)

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

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

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

Solution (Python):
def gcd(x, y):
  if y==0:return x
  else:return gcd(y,x%y)

X,Y=[int(i) for i in input().split()]
G=gcd(X,Y)
if G==Y:print(-1)
else :print(X)

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

Solution (Python):
x, y = map(int, input().split())
if x == y or x % y == 0:
  print(-1)
else:
  now = x
  k = 1
  M = pow(10, 18)
  while now <= M:
    now = k * now
    if now % y != 0:
      break
    k += 1
  print(now)

Solution (Python):
x,y = map(int,input().split())
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*(b+1))

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

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

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

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())
ans = -1
if X % Y :
  ans = X * (Y - 1)
print(ans)

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

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

for i in range(2,(10**18)//x):
    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())
print(x*(y+1) if x%y else -1)

Solution (Python):
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
from operator import itemgetter

def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


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 range(len(a)):
        print(a[i])

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








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

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

Solution (Python):
X, Y = map(int, input().split())
flag = 0
for i in range(1, 1000000):
  if (X*i) % Y != 0:
    print(X*i)
    flag = 1
    break
if flag == 0:
  print(-1)

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

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

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())
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())
if X % Y == 0:
    print(-1)
else:
    print(X*(Y+1))

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())
if x % y == 0:
    print(-1)
else:
    print(x)

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

Solution (Python):
num = input().split(" ")
num = [int(i) for i in num]
if num[0]%num[1]==0: print("-1")
else: print(num[0])

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())
ans = X
if(X%Y == 0):
  ans = -1
print(ans)

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())
i = 1
while X < 1000000001:
  X *= i
  if(X%Y != 0):
    print(X)
    break
  i += 1
else:
  print(-1)

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

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

flag = True
for i in range(1, 10 ** 6):
    if X * i % Y != 0:
        print(X * i)
        flag = False
        break

if flag:
    print(-1)

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:
    ans = -1
else:
    ans = X * (Y - 1)

print(ans)
print()

Solution (Python):


import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul, xor
from copy import copy, deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits
from datetime import date

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 round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
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

X,Y=MAP()

if X<Y:
    print(X)
elif X==Y:
    print(-1)
else:
    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(-(x%y<1)or x)

Solution (Python):
x,y=map(int,input().split());print(-(x%y<1)or x)

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

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

Solution (Python):
import fractions
def lcm(a,b):
  return a*b/fractions.gcd(a,b)
x,y=map(int,input().split())
a=lcm(x,y)
if x%y==0:
  print(-1)
else:
  b=1
  while True:
    b+=1
    c=x*b
    if c%y!=0:
      print(c)
      break

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

Solution (Python):
X, Y = [int(x) for x in 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 = 1
    n = x
    while n % y == 0:
        n = i * x
        i += 1
    print(n)

Solution (Python):
x,y = (int(i) for i in input().split())
if x%y == 0 or y == 1:
  print(-1)
  exit()
else:
  print(x*(y-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:
  print(x)

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

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

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

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

Solution (Python):
temp = input().split(" ")
X = int(temp[0])
Y = int(temp[1])
i = 2
while True:
    tgt = X * i
    if X == Y:
        print(-1)
        break
    elif tgt % Y != 0:
        print(tgt)
        break
    elif i == 100000:
        print(-1)
        break
    else:
        i += 1

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

if X % Y == 0:
    ans = -1

else:
    ans = X

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,input().split(" "))
if X%Y == 0:
  print(-1)
else:
  print(X)

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

Solution (Python):
b=[]
b = input().strip().split()
b[0]=int(b[0])
b[1]=int(b[1])
if b[0]%b[1]==0:
	print("-1")
else:
	print(b[0])

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

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 :
    for i in range(x,10**18+1) :
        if (i%x==0)and(i%y!=0) :
            print(i)
            break

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())
if x%y==0:
    print(-1)
else:
    print(x*(y+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:
    ans = -1
elif X > Y:
    if X%Y == 0:
        ans = -1
    else:
        ans = X
else:
    ans = X
print(ans)

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

Solution (Python):
x, y = map(int, input().split())
print(x if x % y 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, input().split())
i = X * 2
while True:
    if i > pow(10, 18) or X % Y == 0:
        print(-1)
        break
    if i % Y != 0:
        print(i)
        break
    i += X

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

Solution (Python):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

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

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

Solution (Python):
a, b = map(int, input().split())
print('-1' if a % b == 0 else 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(-1)
else:
  i = 1
  n = x
  while n % y == 0:
    n = i * x
    i += 1
  print(n)

Solution (Python):
a,b=map(int,input().split())
print([a*b+a,-1][a%b==0])

Solution (Python):
def gcd(p,q):
      if p%q==0:
            return q
      else:
            return gcd(q,p%q)

x,y=map(int,input().split())
g=gcd(x,y)
if g==y:
      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(X if X % Y else -1)

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

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