#include <cstdio>
#include <cstring>

#define MAXN 16

int N, K;
int a[ MAXN ];
int bio[ 380 ];
int cookie;

inline int mod( int x ) {
       return ( x + 360 ) % 360;
}

int dfs( int x ) {
    if( x == 0 ) return 1;
    if( bio[ x ] == cookie ) return 0;
    bio[ x ] = cookie;
    
    for( int i = 0; i < N; ++i ) {
         if( dfs( mod( x - a[i] ) ) ) return 1;
    }
    
    return 0;
}

int main( void )
{
    scanf( "%d%d", &N, &K );
    
    for( int i = 0; i < N; ++i )
         scanf( "%d", a + i );
    
    for( int i = 0; i < K; ++i ) {
         int x; scanf( "%d", &x );
         ++cookie; printf( dfs( x ) ? "DA\n" : "NE\n" );
    }
     
    return 0;
}
