#Lutece2356. Slay the Spire
Slay the Spire
Migrated from Lutece 2356 Slay the Spire
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
Slay The Spire is a rogue-like video game with deck-building card game mechanics. The goal is to work through several levels of a spire, each level having a monster with a boss character at the end of the level.
This day The Ironclad called Mengnan hopes to conquer this spire again. Mengnan is the one with careful plans so he would like to know if he is able to achieve this challenge with calculation.
Mengnan starts the game with health point and gold. When it drops to zero, Mengnan will fall down and have to restart from the bottom of the spire. The upper limit of Mengnan's health point is . As for gold, this time Mengnan will not use any of them.
Mengnan is not a rash guy. Mengnan brings a smoke with himself. He can use (for only once) the smoke to escape fighting with the monster of any level except the last level guarded by boss, and go to the next level straightly.
Mengnan is a tough guy. Mengnan can get a health point recovery with points when he climbs up one level (whether using smoke).
Mengnan has two relics which are beneficial for his fight. Golden Idol makes Mengnan gain more gold after each battle and Magic Flower brings more healing whenever Mengnan gets a headlth recovery.
Mengnan spares his every free time to practice this game. He knows well the monster of each level so that he knows he will drop a health point with points if he fights with the monster of the level.
Now Mengnan asks you, the master of Slay The Spire, to tell him if he could succeed if he optimizes his plan.
Input
On the first line of the input are two integers () and (), indicating the health point when Mengnan starts this game and the number of levels of the spire.
On the second line of the input are n integers , indicating the health point Mengnan will drop if he fights with the monster of the () level.
Output
Print if Mengnan can win this game. If he can somehow then print YES
, else print NO
. Note that the answer is case sensitive.
Samples
10 5
1 2 3 4 10
YES
10 3
10 10 10
YES
Note
It seems like using the smoke when its necessary (or Mengnan'll be dead) is not always the best choice.
Resources
电子科技大学第十届ACM趣味程序设计竞赛