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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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])
#n = ip()                                     #入力整数1つ
a,b= (int(i) for i in input().split())       #入力整数横2つ以上
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
#こっから
if a%b == 0:
    print(-1)
else :
    print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)
print()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

else:
    ans = X

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# vim: set fileencoding=utf-8 :
x, y = map(int, raw_input().split())

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

n = 1
top = pow(10, 18)

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

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

    n += 1

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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


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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

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

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


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


if __name__ == "__main__":
        main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
x, y = map(int, input().split())
for k in range(1, 100000):
    if k * x % y != 0:
        print(k * x)
        break
else:
    print(-1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import datetime

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()
    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            array_temp = []

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

                flg = 1

            else:

                flg = 0
    finally:


        return array_result


arr_data = getinputdata()

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


cnt = 1
#
#if x // y>=1 and x % y==0:
#    
#    print(-1)
#
#else:
#    while cnt<10**18:
#
#        if cnt%x==0 and cnt%y!=0:
#
#            print(cnt)
#            break
#
#        else:
#            cnt+=1
#            
##print(-1)
#

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

        if i % y != 0:

            print(i)
            break

    else:

        print(-1)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    X, Y = map(int, input().split())
    # a = n * X
    # x = m * Y: NG
    # a % Y = 0: NG
    if X % Y == 0:
        print(-1)
        return

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

else:
    print(a)

Submission status: Accepted

Solution code:
from fractions import gcd

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

func()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

max_num = 10**18 // X


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import sys

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


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

    return x*y-x


print(main())

Submission status: Accepted

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

solve()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from fractions import gcd

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

Submission status: Accepted

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

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