One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce $x \operatorname{mod} m$ (remainder after dividing x by m) more details. Unfortunately, no customer has ever bought any mythical detail, so all the details produced stay on the factory. 

The board of directors are worried that the production by the given plan may eventually stop (that means that there will be а moment when the current number of details on the factory is divisible by m). 

Given the number of details a on the first day and number m check if the production stops at some moment.


-----Input-----

The first line contains two integers a and m (1 ≤ a, m ≤ 10^5).


-----Output-----

Print "Yes" (without quotes) if the production will eventually stop, otherwise print "No".


-----Examples-----
Input
1 5

Output
No

Input
3 6

Output
Yes

Difficulty: interview

Starter code:

Solutions:
a,m = map(int,input().split())

for i in range(100000):
    if a%m==0:
        print("Yes")
        quit()
    else:
        a+=a%m
print("No")

a, m = map(int, input().split())

while not m%2:
	m >>= 1
if(a%m==0):
	print('Yes')
else:
	print('No')

a, m = list(map(int, str.split(input())))
mem = set()
while a not in mem:

    mem.add(a)
    if a % m == 0:

        print("Yes")
        return

    else:

        a = (a + a % m) % m

print("No")


#!/bin/env python3
a,m=input().split(' ')
a,m=int(a), int(m)
d=set()
d.add(a%m)

while a%m!=0:
    a+=a%m
    if a%m in d:
        print('No')
        break

    d.add(a%m)

if not a%m:
    print('Yes')


a, m = list(map(int, input().split()))
s = set()
while True:
    a %= m
    if a in s:
        print('Yes' if 0 in s else 'No')
        break
    s.add(a)
    a *= 2


a, m = map(int, input().split())
for i in range(m):
    b = a % m
    a += b
    if b == 0:
        print("Yes")
        return
print("No")

a, m = list(map(int, input().split()))
while m % 2 == 0:
    m = m // 2
if a % m == 0:
    print('Yes')
else:
    print('No')

from fractions import gcd
from sys import stdin

lines = list([_f for _f in stdin.read().split('\n') if _f])

def parseline(line):
	return list(map(int, line.split()))

lines = list(map(parseline, lines))

a, m = lines[0]

if a * pow(2, m, m) % m != 0:
	print("No")
else:
	print("Yes")


n, m = map(int, input().split())

a = [False] * m
n %= m
while a[n] == False:
    a[n] = True
    n = (n + n) % m

print("Yes") if a[0] else print("No")


a,m = map(int,input().split())

for i in range(1000):
    if a%m==0:
        print("Yes")
        quit()
    else:
        a+=a%m
print("No")

a,m = map(int,input().split())

for i in range(100):
    if a%m==0:
        print("Yes")
        quit()
    else:
        a+=a%m
print("No")

a,m = map(int,input().split())

for i in range(50):
    if a%m==0:
        print("Yes")
        quit()
    else:
        a+=a%m
print("No")

a,m = map(int,input().split())
while not m%2: m //= 2
print('No' if a%m else 'Yes')

a,m = map(int,input().split())

for i in range(32):
    if a%m==0:
        print("Yes")
        quit()
    else:
        a+=a%m
print("No")

a,m = map(int,input().split())

for i in range(31):
    if a%m==0:
        print("Yes")
        quit()
    else:
        a+=a%m
print("No")

a,m = map(int,input().split())

for i in range(24):
    if a%m==0:
        print("Yes")
        quit()
    else:
        a+=a%m
print("No")

a,m = map(int,input().split())

for i in range(17):
    if a%m==0:
        print("Yes")
        quit()
    else:
        a+=a%m
print("No")

import sys
import math
a, m = list(map(int, input().split()))

if a % m == 0 or 2*a % m == 0:
    print("Yes")
    return

a1 = a
f = False
for k in range(int(math.log(m, 2)) + 1):
    if a * (2 ** k) % m == 0:
        f = True
        break

if f:
    print("Yes")
else:
    print("No")


y = input("").split(" ")
a = int(y[0])
m = int(y[1])
while m%2 == 0:
    m = m/2
if a%m == 0:
    print("Yes")
else:
    print("No")


a, b = list(map(int, input().split(' ')))
bad = a
for i in range(133742):
    bad = bad*2
    if bad % b == 0:
        print("Yes")
        quit()
    else:
        bad %= b
print("No")


lis=input().split()
a=int(lis[0])
m=int(lis[1])
if m%2==1:
    if a%m==0:
        print('Yes')
    else:
        print('No')
else:
    k=0
    while 2**k<=m and m%(2**k)==0:
        k+=1
    k-=1
    u=m//(2**k)
    if (a%m)%u==0:
        print('Yes')
    else:
        print('No')


ip=list(int(n) for n in input().split())
import math
a=ip[0]
m=ip[1]
a%=m
af=[a]
x=1;k=1;count=0;countlimit=int(math.floor(math.log(m,2)))
while (k==1):
	a=((a+a%m)%m)
	if a==0:
		print("Yes")
		k=0
	else:
		for check in af:
			if a==check:
				print("No")
				k=0
	if	count<=countlimit:
			af.append(a)
			count+=1
return


ip=list(int(n) for n in input().split())
import math
a=ip[0]
m=ip[1]
while (a%2==0 and m%2==0):
	a/=2;m/=2
a%=m
af=[a]
x=1;k=1;count=0;countlimit=0;m2=m
while (m2%2==0):
	countlimit+=1
	m2/=2
while (k==1):
	a=((a*2)%m)
	if a==0:
		print("Yes")
		k=0
	else:
		for check in af:
			if a==check:
				print("No")
				k=0
	if	count<=countlimit:
			af.append(a)
			count+=1
return


ip=list(int(n) for n in input().split())
import math
a=ip[0]
m=ip[1]
while (a%2==0 and m%2==0):
	a/=2;m/=2
a%=m
af=[a]
x=1;k=1;count=0;countlimit=0;m2=m
while (m2%2==0):
	countlimit+=1
	m2/=2
while (k==1):
	a=((a*2)%m)
	if a==0:
		print("Yes")
		k=0
	else:
		for check in af:
			if a==check:
				print("No")
				k=0
	if	count<countlimit:
			af.append(a)
			count+=1
return


ip=list(int(n) for n in input().split())
import math
a=ip[0]
m=ip[1]
while (a%2==0 and m%2==0):
	a/=2;m/=2
a%=m
af=[a]
x=1;k=1;count=1;countlimit=0;m2=m
while (m2%2==0):
	countlimit+=1
	m2/=2
while (k==1):
	a=((a*2)%m)
	if a==0:
		print("Yes")
		k=0
	else:
		for check in af:
			if a==check:
				print("No")
				k=0
	if	count<=countlimit:
			af.append(a)
			count+=1
return