NOCHANGE - No Change

Though it might be hard to imagine, the inhabitants of a small country Additivia do not know of such thing as change, which probably has to do with them not knowing subtraction either. When they buy something, they always need to have the exact amount of addollars, their currency. The only other option, but not a really attractive one, is over-paying.

Professor Adem, one of the Additivian mathematicians came up with an algorithm for keeping a balanced portfolio. The idea is the following. Suppose you have more coins of value $v_1$ than coins of value $v_2$. In this case you should try to spend at least as many coins of value $v_1$ as those of value $v_2$ on any buy you make. Of course spending too many $v_1$ coins is not a good idea either, but to make the algorithm simpler professor Adem decided to ignore the problem. The algorithm became an instant hitand professor Adem is now designing a kind of "electronic portfolio" with built-in Adem's algorithm. All he needs now is a software for these machines, that will decide whether a given amount ofaddollars can be paid using a given set of coins according to the rules of Adem's algorithm. Needless to say, you are his chosen programmer for the task.

Problem

Write a program that reads the description of a set of coins and an amount of addollars to be paid, and determines whether you can pay that amount according to Professor Adem's rules.

Input

The input starts with the amount of addollars to be paid $x$, where $1 \le x \le 100,000$. The number of different coin values $k$ follows, where $1 \le k \le 5$. The values of the coins $v_1, \ldots, v_k$ follow, where $1 \le v_i \le 10,000$.

Notice that the order among coin values is significant: you need to spend at least as many coins of value $v_1$ as coins of value $v_2$, at least as many coins of value $v_2$ as those of value $v_3$, and so on. You may assume that you have a sufficiently large number of coins of each value.

Output

Your program should output for each test case either a single word "YES", if the given amount can be paid according to the rules, or a single word "NO" otherwise.

Example

Input:
13 3 9 2 1

Output:
NO

 < Previous 1 2 3 4 5 Next > vrintle: 2021-06-24 07:25:25 Hard-work pays a lot guys, got 5 AC in a row \o/ surajxd: 2020-08-21 10:47:51 @s_tank00_ itna rota kahe hai re. s_tank00_: 2020-08-13 12:01:10 question statement not mentioned properly also insufficient test cases horro: 2020-06-22 19:37:51 n1*v1+n2*v2+n3*v3....=x then n1>=n2>=n3>=..>=0 ; no need to sort in dec/inc. order of value of v; O(x*k) ACC luckydude: 2020-06-05 13:52:50 AC in one go Worth doing amansahu112: 2020-05-03 14:12:41 150 AC..!! aryan29: 2020-04-02 11:09:44 Nice Ques worth doing garry_555: 2020-02-29 20:39:19 try bottom down approach :) nyc prob smso: 2019-04-26 04:52:59 helpful testcases: 18 3 4 4 1 YES 18 2 4 1 YES masterassassin: 2019-02-24 16:27:19 AC finally.. I take WA on test 10 because i didn't know that we could take some of money not all.. try this test if you take WA also : 11 3 9 2 1 here we could take nine and two only