#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

const int KORAK = 200;

int n, k;
int imam[12];
int t;
bool can[400];
int kut;

void idi(int x) {
	for(int i = 0; i < n; ++i) {
		t = x;
		for(int j = 0; j < KORAK; ++j) {
			t += imam[i];
			if (t >= 360) t -= 360;
			if (!can[t]) {can[t] = true; idi(t);}
		}

		t = x;
		for(int j = 0; j < KORAK; ++j) {
			t -= imam[i];
			if (t < 0) t += 360;
			if (!can[t]) {can[t] = true; idi(t);}
		}
	}
}

int main(void) {
	scanf("%d %d", &n, &k);
	memset(can, false, sizeof(can));

	for(int i = 0; i < n; ++i) {
		scanf("%d", &imam[i]);
		
		can[imam[i]] = true;
		
		t = imam[i];	
		for(int j = 0; j < KORAK; ++j) {
			t += imam[i];
			if (t >= 360) t -= 360;
			can[t] = true;
		}

		t = imam[i];	
		for(int j = 0; j < KORAK; ++j) {
			t -= imam[i];
			if (t < 0) t += 360;
			can[t] = true;
		}
	}
	
	for(int i = 0; i < 360; ++i) if (can[i]) idi(i);

	for(int i = 0; i < k; ++i) {
		scanf("%d", &kut);
		if (can[kut]) printf("DA\n"); else printf("NE\n");
	}

	//system("pause");
	return 0;
}
