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
than coins of value
. In this case you should try to spend at least as many
coins of value
as those of value
on any buy you make.
Of course spending too many
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 hit
and 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 of
addollars 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 specification
The input starts with the amount of
addollars to be paid
, where
.
The number of different coin values
follows,
where
.
The values of the coins
follow,
where
.
Notice that the order among coin values is significant:
you need to spend at least as many coins of value
as coins
of value
, at least as many coins of value
as those of value
, and so on. You may assume
that you have a sufficiently large number of coins of each value.
Output specification
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.
Sample input
13 3 9 2 1
NO