Raju and Rani and playing games in the school. Raju has recently learned how to draw angles. 
He knows how to draw some angles. He also can add/subtract any of the two angles he draws. Rani now wants to test Raju.    

Input:
First line contains N and K, denoting number of angles Raju knows how to draw and K the number of angles Rani will tell Raju to draw. 
Next line contains, N space separated integers denoting the angles which Raju knows how to draw.    Next line contains K space separated numbers denoting the angles Rani wants Raju to draw.   

Output:
For each of the K angles Rani wants Raju to draw, output "YES" or "NO" (quotes for clarity) if he can draw those angles or not respectively.      

Constraints: 
1 ≤ N,K ≤ 10 
0 ≤ All\; angles ≤ 360

SAMPLE INPUT
1 2
100
60 70

SAMPLE OUTPUT
YES
NO

Explanation

Adding 100 fifteen times gives 1500 degrees, which is same as 60.
70 cannot be drawn any way.
inp=raw_input().split()
n=int(inp[0])
k=int(inp[1])
inp=raw_input().split()
na=[]
i=0
while i<n:
    na.append(int(inp[i]))
    i+=1
i=0
inp=raw_input().split()
ka=[]
while i<k:
    ka.append(int(inp[i]))
    i+=1
l=[]
i=0
p=k
se=set()
while i<n:
    t=na[i]
    se.add(t%360)
    k=2
    while (t*k)%360 not in se:
        se.add((t*k)%360)
        k+=1
    l.append(se)
    se=set()
    i+=1
i=0
k=p
while i<k:
    f=1
    for item in l:
      try:
        if ka[i] in item:
            print 'YES'
            f=0
            break
      except Exception:pass


    if f==1:
        print 'NO'
    i+=1