URI Online Judge | 2089


By Gabriel Duarte, UNIFESO BR Brazil

Timelimit: 6

Every day in college intervals you and your friend go to college cafeteria as soon as possible to buy a snack. Although you are very quick on the path between the building of the course and the snack bar, you always end up facing a huge queue.

Your friend is very methodical, so every day to get in the queue it removes all your coins from his pocket and checks if he can pay the snack entirely with the money he has, without requiring the employee canteen give some change, after all the change is always given in coins and your friend does not like some have coins, so if he can not pay this way, it makes the payment on the card. As the queue is always very large and most of the time you are among the latter, his friend performs the count calmly so that there is no error.

Today was a different day, to get in the cafeteria, you and your friend came across something very strange: the queue was small. His friend was very worried and nervous not get the time to check your coins and have to make the people who are behind you wait. Trying to calm down, you explain to him that the problem of checking the coins is very simple and you are able to write a program in the cell quickly that, given all the coins with their values and the price of breakfast, inquire if you can pay using only coins the total value of the snack.

As you are one of the first in line, write it the fastest program possible for your friend to make a decision before you get in the box.


The entrance has several test cases. Each case begins with two integers V (1 ≤ V ≤ 10^5) and N (1 ≤ N ≤ 10^3), representing respectively the value of the snack that your friend want to buy and the amount of coins that your friend has. The next line will be N integers, where Xi (1 ≤ Xi ≤ 10^5) represents the value of the ith currency. The input ends with V = 0 and N = must not be processed.


For each input your program must print a line containing sim, if possible make the payment the way you want your friend or nao, otherwise.

Input Sample Output Sample

25 4
1 5 10 20
7 6
1 1 3 4 4 5
20 4
25 10 5 1
0 0