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==0:
  print(-1)
  exit()
  
i = 2
while True:
  if X*i % Y != 0 and X*i <= 10**18:
    print(X*i)
    exit()
  i += 1
  if X*i > 10**18:
    print(-1)
    exit()

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

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

while True:
    x += tmp 
    if x%y != 0:
        print(x)
        exit()

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

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

Solution (Python):
import math
a, b = map(int, input().split())
if(a % b == 0):
  print(-1)
else:
  i = math.gcd(a, b)
  c = a // i
  d = b // i
  print(c * d * i + a)

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

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

[x,y]=L()

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

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

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil,pi,factorial
    from operator import itemgetter
    def I(): return int(input())
    def MI(): return map(int, input().split())
    def LI(): return list(map(int, input().split()))
    def LI2(): return [int(input()) for i in range(n)]
    def MXI(): return [[LI()]for i in range(n)]
    def SI(): return input().rstrip()
    def printns(x): print('\n'.join(x))
    def printni(x): print('\n'.join(list(map(str,x))))
    inf = 10**17
    mod = 10**9 + 7

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



        
        
        
        
        
    
if __name__=="__main__":
    main()

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

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

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

Solution (Python):



from fractions import gcd
from itertools import combinations,permutations,accumulate, product 

from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect














import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7


from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
x,y = readInts()
MAX = 10**18
if x%y == 0:
    print(-1)
    exit()
while x <= 10 ** 18:
    if x%y != 0:
        print(x)
        exit()
    x += x
print(-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())
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):
def LI():
    return list(map(int, input().split()))


X, Y = LI()
a = 10**18//X
if X == Y:
    ans = -1
elif X % Y == 0:
    ans = -1
else:
    for i in range(2, a+1):
        if X*i % Y == 0:
            continue
        ans = X*i
        break
print(ans)

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

Solution (Python):
X, Y = map(int, input().split())
ans = -1
for i in range(10**8):
  Z = X*(i+2)
  if Z%Y != 0 and Z <= 10**18:
    ans = Z
    break
  if Z > 10**18:
    break
print(ans)

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

Solution (Python):
from math import gcd
X, Y = map(int, input().split())
l = X * Y // gcd(X, Y)
if l == X:
    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 math
x,y = map(int, input().split())
xy = x*y//(math.gcd(x,y))
if xy > x: print(x)
else: print(-1)

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

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


if __name__ == '__main__':
    main()

Solution (Python):

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

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

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

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

if __name__ == '__main__':
    main()

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

Solution (Python):
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

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

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

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

resolve()

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

Solution (Python):
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rf = lambda: map(float, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

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

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

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

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

Solution (Python):
'''
Created on 2020/08/20

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  X,Y=map(int,pin().split())
  if X%Y==0:
    print(-1)
    return 
  print(X)
  return 

main()

Solution (Python):
import sys, math, re
from functools import lru_cache
from collections import defaultdict
sys.setrecursionlimit(500000)
MOD = 10**9+7

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

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    X, Y = mi()
    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:
    ans = -1
else:
    ans = 0
    cnt = 2
    while True:
        if (x*cnt)%y != 0:
            ans = x*cnt
            break
        else:
            cnt += 1

print(ans)

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

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

Solution (Python):
import sys
from math import gcd
input = sys.stdin.readline
X, Y = map(int, input().split())
g = gcd(X, Y)
if g != Y: print(X * Y // g + X)
else: print(-1)

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

Solution (Python):
import math
X,Y = map(int,input().split())
a = X*Y//math.gcd(X, Y)-X
if a == 0:
    print(-1)
    exit()
print(a)

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

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

Solution (Python):
import collections
import math


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

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


if __name__ == '__main__':
    main()

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



def linput(ty=int, cnv=list):
    return cnv(map(ty, input().split()))

def vinput(rep=1, ty=int, cnv=list):
    return cnv(ty(input().rstrip()) for _ in "*"*rep)

def gcd(n,m):
    while m: n,m = m, n%m
    return n

def lcm(n,m): return n*m//gcd(n,m)

def main():
    X,Y = linput()

    res = X if X%Y else -1
    print(res)
    
    
    
    

if __name__ == "__main__":
    main()

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    X, Y = map(int, readline().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:
  print(X)

Solution (Python):
import sys
def IL(): return map(int,sys.stdin.readline().rstrip().split())

if __name__=='__main__':
    x,y = IL()
    if x==y:
        print(-1)
        exit()
    for rep in range(x,10**9+1,x):
        if rep%y!=0:
            print(rep)
            exit()
    print(-1)
    exit()

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

while True:
    a = (x*i) % y
    if a != 0:
        ans = x*i
        break
    else:
        ans = -1
        break

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

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

Solution (Python):
def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

def lcm(x, y):
    return x // gcd(x, y) * y

X, Y = map(int, input().split())
L = lcm(X, Y)
res = L - X
if (L - X) % Y != 0 and (L - X) <= 10**18:
    print(L - X)
else:
    print(-1)

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

Solution (Python):
import sys

input = sys.stdin.readline


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

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

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    X, Y = LI()

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

if __name__ == '__main__':
    resolve()

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

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

Solution (Python):
import math
x,y = map(int,input().split())
lcm = (x*y)//math.gcd(x,y)
flag = False
for i in range(x,lcm):
  if i%x==0 and i%y!=0:
    flag=True
    print(i)
    break
if not flag:
  print(-1)

Solution (Python):
X,Y = list(map(int,input().split()))
if X % Y == 0:
  print(-1)
else:
  for i in range(1,1000000):
      if X*i > 10**18:
          print(-1)
          break
      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())

if x == y: print(-1)
elif (x/y).is_integer(): print(-1)
else: print(x)

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

Solution (Python):
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())
for c in range(2,1000000):
    if c * x % y != 0:
        print(c * x)
        break
else:
    print(-1)

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

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    x,y=MI()
    if x%y==0:
        print(-1)
    else:
        print(x*(y+1))

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

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

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

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

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



from fractions import gcd
from itertools import combinations,permutations,accumulate 

from collections import deque,defaultdict,Counter
import decimal
import re











import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
x,y = readInts()
MAX = 10**18
if x % y == 0:
    print(-1)
    exit()
while x <= 10**18:
    if x%y != 0:
        print(x)
        exit()
    x += x
print(-1)

Solution (Python):
a, b = map(int, input().split())
ans = -1
for i in range(1, 4):
  if a * i % b != 0:
    ans = a * i
print(ans)

Solution (Python):
X, Y = map(int, input().split())
if X % Y == 0:
  ans = -1
elif Y % X == 0:
  ans = X * (Y//X + 1)
else:
  ans = X
if ans > 10**18:
  ans = -1
if X == 1 and Y != 1:
  ans = 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 and 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):
import sys
from fractions import gcd

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

X, Y = inm()


def solve():
    if X % Y == 0:
        return -1
    return X * (Y + 1)


print(solve())

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)

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 accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

X, Y = MAP()

print(X if X%Y else -1)

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

Solution (Python):
X,Y=map(int,input().split())
print([-1,X][X%Y>0])

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

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

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:
  exit(print(-1))
t=0
for i in range(1000001):
  t+=x
  if t%y!=0:
    print(t)
    exit(0)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7


X, Y = MAP()

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 = list(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:
    print(x)

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

import math

import bisect
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


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


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


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count





X,Y = IL()

if X%Y==0:
  print(-1)
else:
  for i in range(1,Y):
    if X*i%Y:
      print(X*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,input().split())
if x%y==0:
    print(-1)
else:
    print(x)

Solution (Python):
from statistics import median


from fractions import gcd
from itertools import combinations 
from collections import deque
from collections import defaultdict
import bisect










import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
x,y = readInts()
if x % y == 0:
    print(-1)
    exit()
while x <= 10**18:
    if x % y != 0:
        print(x)
        exit()
    x += x
print(-1)

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

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


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


if __name__ == '__main__':
    resolve()

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


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

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

    for res in range(x, 10 ** 18, x):
        if res % y:
            print(res)
            break


if __name__ == '__main__':
    resolve()

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:
    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:
  for i in range(10**9):
    if (a * i) % b != 0:
      print(a * 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, input().split())

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

Solution (Python):
temp = input()
temp2 = temp.split(" ")
temp = []
for i in temp2:
    temp.append(int(i))

for i in range(1,100000000):
    ans1 = temp[0]*i
    if ans1 % temp[1] != 0:
        break
    if ans1 >= 10^18:
        ans1 = -1
        break
print(ans1)

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
x, y = map(int, input().split())

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

ans = x
while ans<=10**18:
    if x%y!=0:
        print(x)
        exit()
    else:
        ans+=x

Solution (Python):
def divisors(n):
    d=[]
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            d.append(i)
            if i!=n//i:
                d.append(n//i)
    d.sort()
    return d

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

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


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

if x % y == 0:
	print(-1)
else:
	i = 2
	
	while True:
		if (x * i) % y != 0:
			print(x * i)
			break
		else:
			i += 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())
print(-1 if x%y<1 else x)

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

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

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