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.
def formatter(a):	
	if a == '360':
		return 0
	return int(a)

super_array = []
for i in xrange(360):
	super_array.append([])
	num = i
	j=1
	while num not in super_array[i]:
		super_array[i].append(num)
		j += 1
		num = i*j
		while num >= 360:
			num -= 360

n, k = map(int, raw_input().split())
gangles = map(formatter, raw_input().split())
cangles = map(formatter, raw_input().split())

all_angles_array = []
for i in gangles:
	all_angles_array.extend(super_array[i])
all_angles_array = list(set(all_angles_array))
all_angles_array.sort()

for c in cangles:
	counter = False
	if c in all_angles_array:
		print "yes".upper()
		counter = True
	if counter:
		continue
	for i in all_angles_array:
		if i<c:
			if c-i in all_angles_array:
				print "yes".upper()
				counter = True
				break
		else:
			break
	if counter:
		continue
	for i in all_angles_array:
		if i>c:
			if c+360-i in all_angles_array:
				print "yes".upper()
				counter = True
				break
	for i in all_angles_array:
		shit = i+c
		if shit > 360:
			shit -= 360
		if shit in all_angles_array:
			print "yes".upper()
			counter = True
			break
	if counter:
		continue
	for i in all_angles_array:
		val = i-c
		if val<0:
			val += 360
		if val in all_angles_array:
			print "yes".upper()
			counter = True
			break
	if not counter:
		print "no".upper()