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:
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def my_round(a,dig=0):
    p = 10 ** dig
    return (a * p * 2 + 1) // 2 / p

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b): #最小公倍数
    return a/gcd(a,b)*b

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): #素因数分解
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

def main():
    x,y = map(int,input().split())
    if x == y:
        print(-1)
        return
    if y % x == 0:
        mul = y // x + 1
        print(x * mul)
        return
    for i in range(1,4):
        if (x * i) % y != 0:
            print(x * i)
            return
    print(-1)
    return

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
from fractions import gcd


def lcm(a, b):
    """
    aとbの最小公倍数を計算します。
    """
    return a * b // gcd(a, b)


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

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

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

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

Submission status: Accepted

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

ans = -1
for i in range((x*y)//fractions.gcd(x, y), 0, -x):
    if i%y != 0:
        ans = i
        break
print(ans)

Submission status: Accepted

Solution code:
# AtCoder Petrozavodsk Contest 001 - A
# -*- encoding: UTF-8 -*-
x, y = map(int, input().split())

result = -1

if x % y == 0 :
  result = -1
else: 

  n = (10 ** 18) // x

  for i in range(2, n+1) :
    m = x * i
    if (m % y) != 0 :
      result = m
      break

print(result)

Submission status: Accepted

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

if X % Y == 0 or X>10**18:
    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*(b-1))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
X, Y = map(int, input().split())
#A = int(input())
#B = int(input())

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

Submission status: Accepted

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

while num <= 10**18:
  if num%Y != 0:
    print(num)
    exit()
  num += X
print(-1)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    x, y = list(map(int, readline().split()))
    if x % y != 0:
        print(x)
    else:
        print(-1)


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

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

i =2

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

Submission status: Accepted

Solution code:
def main():
    X,Y = map(int,input().split())
    if X%Y==0:
        print(-1)
    else:
        for i in range(1,10**8):
            if (X*i)%Y != 0:
                print(X*i)
                exit()
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
if x<y:
    print(x)
    exit()

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

temp = gcd(x,y)

if y == temp:
    print(-1)
else:
    print(x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def examA():
    X, Y = LI()
    ans = -1
    if X%Y!=0:
        ans = X
    print(ans)


import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()

Submission status: Accepted

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

Submission status: Accepted

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

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


main()

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:
def main():
    X, Y = (int(i) for i in input().split())
    if X % Y == 0:
        print(-1)
    else:
        print(X)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    X,Y=MI()
    if X%Y==0:
        print(-1)
        exit()
    print(X)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# APC 001: A – Two Integers
x, y = [int(s) for s in input().split()]
print(-1 if x % y == 0 else x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X, Y = map(int, 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 or not(X%Y == 0):
	print(X)
else:
	print(-1)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000)
INF = 1<<32


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



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

if __name__ == '__main__':
    main()

Submission status: Accepted

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


if __name__ == '__main__':
    x, y = map(int, input().split(' '))

    main(x, y)

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

Submission status: Accepted

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


if __name__ == '__main__':
    slove()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
    resolve()

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:
a, b = map(int,input().split())

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

Submission status: Accepted

Solution code:
def gcd(a, b):
    """a, bの最大公約数(greatest common divisor:GCD)を求める"""
    if b == 0:
        return a
    return gcd(b, a%b)


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
if x % y != 0:
  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:
from fractions import gcd

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

i=1

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

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

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

solve();

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():

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

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

Submission status: Accepted

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


if __name__ == '__main__':
    slove()

Submission status: Accepted

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

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:
#!/usr/bin/env python3
#APC1 A

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

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

Submission status: Accepted

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

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, input().split())

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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


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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
x,y=map(int,input().split())
k=0
if x%y==0 or x*(y-1)>10**18:
    print(-1)
else:
    print(x*(y-1))

Submission status: Accepted

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

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 = [ int(v) for v in input().split() ]
print(x if x % y != 0 else -1 )

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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

# print(X)
# print(Y)

# print(X % Y)

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, fractions, itertools


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


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    solve(X, Y)

if __name__ == '__main__':
    main()

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

Submission status: Accepted

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

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

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

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

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

print(-1)

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

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

Submission status: Accepted

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

main()

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# APC 1, A - two integers
import itertools
X = [int(el) for el in input().split(' ')]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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=(int(i) for i in input().split())
#print(x,y)

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

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
import fractions
g = fractions.gcd(x,y)
if x == y:
    print(-1)
elif y == 1:
    print(-1)
elif x > y and y == g:
    print(-1)
elif x < y:
    print(x)
elif x % y == 0:
    print(-1)
else:
    print(x)

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:
def abc():
    x, y = map(int, input().rstrip().split())
    if x % y == 0:
        print(-1)
        return
    print(x)


abc()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# APC001A - Two Integers
x, y = list(map(int, input().rstrip().split()))
print(x if x % y else -1)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

X, Y = mi()

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
A - Two Integers
https://atcoder.jp/contests/apc001/tasks/apc001_a

"""
import sys


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


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


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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

print(X)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

g = Y / gcd(X, Y)

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

Submission status: Accepted

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

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())
for i in range(1,10**6):
    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:
  print(X)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
x,y = map(int,input().split())
if x % y  == 0 or x > 10**18:
	print(-1)
else:
	print(x)

Submission status: Accepted

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