NAJVDP - Victory Day Party

no tags 

Because of starting new job, Most of time Dina’s cousins complained about her busy schedules. Dina paining to arrange a party on victory day. She wants to spend that day with her cousins and entertain them as much as she can.

Besides cooking her cousins’ favourite foods, she also make an interesting game. 

The game goes like that. Initially, there is a table with an empty cup and n water mugs on it. Then all players take turns to move. During a move, a player takes a non-empty mug of water and pours all water from it into the cup. If the cup overfills, then we assume that this player lost.

As soon as Dina’s cousin’s heard of the game, they wanted to play it. Dina, on the other hand, wanted to find out whether his cousins can play the game in such a way that there are no losers. You are given the volumes of all mugs and the cup. Also, you know that Dina has (n - 1) friends. Determine if Dina’s cousins can play the game so that nobody loses.


The first line contains integers n and s (2 ≤ n ≤ 100; 1 ≤ s ≤ 1000) — the number of mugs and the volume of the cup. The next line contains n integers a1, a2 ... an (1 ≤ ai ≤ 10). Number ai means the volume of the i-th mug.


In a single line, print "YES" (without the quotes) if his friends can play in the described manner, and "NO" (without the quotes) otherwise.


3 4
1 1 1

3 4
4 4 4


Authored By: Kazi Sharmin Dina

Added by:Najmuzzaman
Time limit:0.5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64