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.



Sample input:
8 6


Sample output:
16

Submission status: Wrong Answer

Solution code:
# 最大公約数
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())
if (X == Y) or (Y == 1):
    print(-1)
else:
    if X < Y:
        print(X)
    else:
        Z = lcm(X, Y + 1)
        if Z <= 10 ** 18:
            print(Z)
        else:
            print(-1)

Submission status: Wrong Answer

Solution code:
import sys                                            
                                                      
x, y = list(map(abs, list(map(int, input().split()))))
                                                      
if x == y or x % y == 0 or y % x == 0:                
    print(-1)                                         
else:                                                 
    for i in range(2, x if x > y else y):             
        if (i * x) % y != 0:                          
            print(i*x)                                
            break

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == "__main__":
    X, Y = map(int, (input().split(' ')))
    max = X
    min = Y
    if X < Y:
        max = Y
        min = X
    if max % min == 0:
        print(-1)
        sys.exit()
    sho = (pow(10, 18) // X)  + 1
    for i in range(2, sho):
        num = X * i
        if (num % Y != 0):
            print(num)
            sys.exit()
    print(-1)

Submission status: Wrong Answer

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

def search(x, y, i):
    return x * i % y != 0
i = 1
if x == y or x % y == 0 or y % x == 0:
    print(-1)
else:
    if search(x, y, i) == False:
        i += 1
        search(x, y, i)
    else:
        print(x * i)

Submission status: Wrong Answer

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

# def search(x, y, i):
#     return x * i % y != 0

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

Submission status: Wrong Answer

Solution code:
import sys

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

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

for i in range(2, abs(x)):
    t = x*i
    if t % y != 0 and abs(t) > abs(y):
        print(abs(t))
        break
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
import sys

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

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

for i in range(2, abs(x)):
    t = x*i
    if t % y != 0 and abs(t) > abs(y):
        print(abs(t))
        break
else:
    print(-1)

Submission status: Wrong Answer

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

if __name__ == "__main__":
    X, Y = map(int, (input().split(' ')))
    max = X
    min = Y
    if X < Y:
        max = Y
        min = X
    lcm_num = lcm(max, min)
    if max % min == 0:
        print(-1)
        sys.exit()
    for i in range(lcm_num, pow(10, 18)):
        if (i % X == 0) and (i % Y != 0):
            print(i)
            sys.exit()
    print(-1)

Submission status: Wrong Answer

Solution code:
import sys                             
                                       
x, y = list(map(int, input().split())) 
                                       
if x == y:                             
    print(-1)                          
    sys.exit()                         
                                       
for i in range(2, abs(x)):             
    t = x*i                            
    if t % y != 0 and t > y:           
        print(abs(t))                  
        break                          
else:                                  
    print(-1)

Submission status: Wrong Answer

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

if x % y == 0 or y % x == 0:
    print('-1')
else:
    for i in range(2, 1000000):
        if x * i > y and x * i % y != 0:
            print(x * i)
            break

Submission status: Wrong Answer

Solution code:
import sys                            
                                      
x, y = list(map(int, input().split()))
                                           
                                      
if x == y:                            
    print(-1)                         
    sys.exit()                        
                                      
for i in range(2, abs(x)):            
    t = x*i                           
    if t % y != 0:                    
        print(abs(t))                 
        sys.exit()

Submission status: Wrong Answer

Solution code:
x, y = map(int, raw_input().split())
for i in xrange(10^18):
    if (i % x == 0) and (not i % y == 0):
        print i
        break
else:
    print -1

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == "__main__":
    X, Y = map(int, (input().split(' ')))
    max = X
    min = Y
    if X < Y:
        max = Y
        min = X
    if max % min == 0:
        print(-1)
        sys.exit()
    for i in range(max+1, pow(10, 18)):
        if (i % X == 0) and (i % Y != 0):
            print(i)
            sys.exit()
    print(-1)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if x%y == 0 or type(x/y) == 'float':
     print('-1')
elif y == 0:
     print(x)
else:
     print(x*2)

Submission status: Wrong Answer

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

if x%y==0:
    print(-1)
else:
    if 2*x>10**18:
        print(-1)
    else:
        print(2*x)

Submission status: Wrong Answer

Solution code:
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

Submission status: Wrong Answer

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

X,Y=map(int,input().split())
if X == 1 and Y!=1:
  print(Y+1)
elif gcd(X,Y)==X or gcd(X,Y)==Y:
  print(-1)
else:
  print(X)

Submission status: Wrong Answer

Solution code:
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:
    print(X * gcd(X, Y))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if x%y == 0 or type(x/y) == 'float':
     print('-1')
elif y == 0:
     print(x)
else:
     i = 1
     while True:
          if x*i % y == 0:
               print(x*i)
               break
          else:
               i += 1
               pass

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if x % y == 0 or y % x == 0:
    print(-1)
else:
    for i in range(2, 1000000):
        if x * i > y and x * i % y != 0:
            print(x * i)
            break

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if x%y == 0 or type(x/y) == 'float':
     print('-1')
else:
     i = 1
     while True:
          if x*i % y == 0:
               print(x*i)
               break
          else:
               i += 1
               pass

Submission status: Wrong Answer

Solution code:
import sys                            
                                      
x, y = list(map(int, input().split()))
                                      
if x == y:                            
    print(-1)                         
    sys.exit()                        
                                      
for i in range(2, x):                 
    t = x*i                           
    if t % y != 0:                    
        print(abs(t))                 
        sys.exit()

Submission status: Wrong Answer

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

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

if X % Y == 0:
    print(-1)
elif gcd(X, Y) == 1:
    print(X)
else:
    print(X * gcd(X, Y))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if a < b:
    print(a)
elif a > b:
    print(b)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
x=[int(i) for i in input().split()]
x.sort()
#print(x)

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

Submission status: Wrong Answer

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

i = 1
x = 0

while i <= pow(10,18):
	if i == 1:
		print(-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)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x=[int(i) for i in input().split()]
x.sort()
#print(x)

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

Submission status: Wrong Answer

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

i = 1
x = 0

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


if x == 0:
	print(-1)

Submission status: Wrong Answer

Solution code:
import numpy as np

x,y = [int(i) for i in input().split()]
if np.mod(x , y) == 0:
    ans = -1
else:
    for k in range(100):
        ans = x * np.random.randint(1000)
        if not np.mod(y,ans) == 0 and np.log10(ans) < 18:
            break
        else:
            ans = -1
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

i = 2
while True:
     if x == y:
          print('-1')
          break
     elif y == 0:
          print('-1')
          break
     elif x*i == y:
          pass
     else:
          print(x*i)
          break

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

x,y = [int(i) for i in input().split()]
if np.mod(x , y) == 0:
    ans = -1
else:
    while True:
        ans = x * np.random.randint(1000)
        if not np.mod(y,ans) == 0 and np.log10(ans) < 18:
            break
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

t=0
for i in range(2,10**9+1):
    if b%a==0 or 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)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

x,y = [int(i) for i in input().split()]
if np.mod(x , y) == 0:
    ans = -1
else:
    while True:
        ans = x * np.random.randint(1000000)
        if not np.mod(y,ans) == 0:
            break
print(ans)

Submission status: Wrong Answer

Solution code:
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:
         flag = 1
         print(A)
         break

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

Submission status: Wrong Answer

Solution code:
import sys
x,y = map(int, input().split())
temp = x
if x == y:
    print(-1)
    sys.exit()
while True:
    temp += 8
    if temp % y != 0:
        print(temp)
        sys.exit()
    elif temp > pow(10, 18):
        print(-1)
        sys.exit()

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
import numpy as np

x,y = [int(i) for i in input().split()]
if np.mod(x , y) == 0:
    ans = -1
else:
    while True:
        ans = x * np.random.randint(1000)
        if np.mod(y,ans) > 0:
            break
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
X,Y=map(int,input().split())
if Y%X == 0 and Y/X > 2:
  print(X*2)
elif Y%X != 0:
  print(X*2)
else:
  print('-1')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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 b%a==0:
		print -1
	else:
		print a

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

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

cond = False
if X == Y:
    pass
else:
    i = 1
    if lcm(X, Y) > 10 ** 18:
        pass
    else:
        while i < 10 ** 9:
            if (X * i) % Y != 0:
                cond = True
                break
        i += 1


if cond:
    print(X * i)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
X,Y=map(int, raw_input().split())
if X==Y:
	print -1
	quit()
elif Y==1:
	print -1
	quit()


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

Submission status: Wrong Answer

Solution code:
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 b%a==0:
		print -1
	else:
		print b

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if x == y:
     print('-1')
elif y == 0:
     print('-1')
elif x*2 == y:
     print(x*3)     
else:
     print(x*2)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X,Y=map(int, raw_input().split())
if X==Y:
	print -1
	quit()
elif Y==1:
	print -1
	quit()


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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

if x == y:
     print('-1')
elif x*2 == y:
     print(x*3)     
else:
     print(x*2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

##t=[1]
##while t[len(t)-1]*2<=n:
##	t.append(t[-1]*2)
##x=0
##i=0
##while i<len(t) and x+t[i]<=n:
##	x=x+t[i]
##	i=i+1
##
##if n&(n+1)==0:
##	print n
##elif k==1:
##	print n
##else:
##	print 2*t[-1]-1

Submission status: Wrong Answer

Solution code:



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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
X, Y = map(int, input().split())
print(X, Y)

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

Submission status: Wrong Answer

Solution code:

X, Y = map(int, input().split())
if (X == Y) or (X == 1) or (Y == 1):
    print(-1)
else:
    for i in range(X, 10**9):
        if X*i > 10**18:
            print(-1)
            break
        if X*i % Y != 0:
            print(X)
            break
    else:
        print(-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if X * (Y - 1) <= (10 ** 18):
	print(X * (Y - 1))
	exit(0)

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:



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

    if X % Y == 0 or Y % X == 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


main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

judge = False
if a%b == 0:
    print(-1)
else:
    for i in range(a, 10 ** 6, a):
        if i % b != 0:
            print(i)
            break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
m = a % b
if m == 0:
    print(-1)
elif a * m > 10 ** 18:
    print(-1)
else:
    print(a * m)

Submission status: Wrong Answer

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

    if X == Y:
        print(-1)
    else:
        print(min(X, Y))

main()

Submission status: Wrong Answer

Solution code:
X,Y = map(int,input().split(" "))
if Y != 1 and X * (Y-1) <= (10 ** 18):
	print(X * (Y-1))
else:
	print(-1)

Submission status: Wrong Answer

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

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

main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# ===================================
# (c) MidAndFeed aka ASilentVoice
# ===================================
# import math, fractions, collections
# ===================================
x, y = [int(x) for x in input().split()]
if x == y:
	print(-1)
else:
	temp = x
	while(temp%y == 0):
		temp += 1
	print(temp)

Submission status: Wrong Answer

Solution code:
X,Y = map(int,input().split(" "))
if Y != 1:
	print(X * (Y-1))
else:
	print(-1)

Submission status: Time Limit Exceeded

Solution code:
X,Y=map(int,input().split())
if X==Y:
  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()

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python

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

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

if x == y:
    print(-1)
elif x != y:
    for i in range(x + 1, 10 ** 18):
        if i % x == 0 and i % y != 0:
            print(i)
            break

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def LI():
    return list(map(int, input().split()))


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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
X, Y = map(int, input().split())
num = X
l = 10**18
while num <= l:
    if num % Y == 0:
        print(num)
    num += X
else:
    print(-1)

Submission status: Time Limit Exceeded

Solution code:
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

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
x,y = map(int,input().split())
ans = -1
i = 1

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

print(ans)

Submission status: Time Limit Exceeded

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

c=-1
while(a!=b):
  if a % b == 0 :
    a*= 2
  else:
    c = a
print(c)

Submission status: Time Limit Exceeded

Solution code:
X, Y = map(int, input().split())
i = 1
if X % Y == 0:
    print(-1)
else:
    while True:
        if i % X == 0 and i % Y != 0:
            print(i)
            break
        else:
            i += 1

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

n = 1000000000000000001

for i in range(n):
    if i % x == 0 and i % y != 0:
        print(i)
        exit()
print(-1)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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