program xy;
var t,d:array[1..11]of integer;
    m,n,j,i,suma,brojac:integer;da:boolean;
begin
 readln(n,m);
 for i:=1 to n do
  read(t[i]);
 for i:=1 to m do
  read(d[i]);
 for i:=1 to m do
 begin
  suma:=0;brojac:=0;da:=false;
  repeat
   for j:=1 to n do
   begin
    suma:=suma+t[j];
    if suma=d[i] then begin
     writeln('DA');da:=true;break;end;
    if suma>360 then suma:=360-suma;
   end;
   inc(brojac);
  until (suma=d[i])or(brojac=360);
  if da=false then writeln('NE');
 end;
end.





