MBINGO  Bingo!
English  Vietnamese 
Albert, Charles and Mary invented a new version of the classical game Bingo. In traditional Bingo the game is presided over by a nonplayer known as the caller. At the beginning of the game each player is given a card containing a unique combination of numbers from 0 to N arranged in columns and rows. The caller has a bag containing N + 1 balls, numbered from 0 to N. On each turn, the caller randomly selects a ball from the bag, announces the number of the drawn ball to the players, and sets the ball aside so that it cannot be selected again. Each player searches his card for the called number and marks it if he ﬁnds it. The ﬁrst player who marks a complete preannounced pattern on the card (for example, a full horizontal line) wins a prize.
In the AlbertCharlesMary version, on each turn, the caller draws a ﬁrst ball, returns it to the bag, draws a second ball, returns it to the bag, and then calls out the absolute diﬀerence between the two ball numbers. To generate even more excitement, before the game started a possibly empty subset of balls is removed from the bag, in such a way that at least two balls remain there. They would like to know if every number from 0 to N may still be called out with the new drawing method considering the balls that were left in the bag.
Input
Each test case is given using exactly two lines. The ﬁrst line contains two integers N and B. The meaning of N was described above (1 ≤ N ≤ 90), while B represents the number of balls which remained in the bag (2 ≤ B ≤ N + 1). The second line contains B distinct integers bi, indicating the balls which remained in the bag (0 ≤ bi ≤ N). The last test case is followed by a line containing two zeros.
Output
For each test case output a single line containing a single uppercase ‘Y’ if is possible to call out every number from 0 to N, inclusive, or a single uppercase ‘N’ otherwise.
Sample input
6 7
2 1 3 4 0 6 5
5 4
5 3 0 1
5 3
1 5 0
0 0
Output for the sample input
Y
Y
N
hide comments
suryadev:
20130901 13:07:12
i think I/O optimization is needed 

ankit kumar sinha:
20130611 19:50:34
@neo can u give few test cases 

Ashish:
20130214 20:21:10
Finally Ac... a little Mistake cost me 4 WA... :( 

karan:
20120401 20:40:16
getting wa.some test cases plz.. 

cegprakash:
20120401 16:16:36
"returns it to the bag" 

Rajkiran Rajkumar:
20120303 14:03:18
In the first test case, how is it possible to get 0? If we can't, then, why print 'Y' for it? Please explain :)


saket diwakar:
20120208 15:10:41
very easy:) 

MR. BEAN :
20111212 07:35:17
easy one :) 

Jay Pandya:
20110129 15:40:35
is this question is at the level of acm icpc???? 
Added by:  ~!(*(@*!@^& 
Date:  20101104 
Time limit:  0.173s1.147s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 
Resource:  ACM ICPC2010 – Latin American Regional 