用来翻译
In a college dormitory, somebody posted an announcement saying there would be a
table with K cupcakes (K>=0) on the first floor of the building. Students thought it
was a great idea and they lined up in a long queue to get a cupcake.
For each student number i, there is a pre-defined maximum number of cupcakes (a i )
he or she could eat in one go. However, it does not mean every student will eat the
maximum number of cupcakes. The actual quantity of cupcakes eaten could be any
number in the range from 1 to the a i . Once a student has taken his or her turn and
eaten the cupcakes, he or she goes back to the end of the queue. This continues until
all the cupcakes are gone. The first student who finds no cupcakes on the table when
it is his or her turn will have to clean up after the party (if K=0, the first student in the
queue has to clean the table).
Among the students, there is a Greedy Guy, who always eats exactly a x cupcakes (if
the number of cupcakes on the table is smaller than a x , then he eats up all that is left).
It is very easy to find out who the Greedy Guy is: his a x is greater than all other a i .
All the students (except the Greedy Guy) want the Greedy Guy to clean up. Your task
is to help them determine if it is possible.
Limitations
2 ≤ N ≤ 10 5 , 0 ≤ K ≤ 10 8 , 1 ≤ a i ≤ 10 9
There is always only one single student with the maximum value of a i .
Input
The first line contains two inegers – N and K , representing the number of students
and the number of cupcakes respectively. The next line contains N integer
numbers a i , representing the maximum number of cupcakes that can be eaten by
student number i in the queue.
Output
The output is “YES” if the students can make relevant arrangements to achieve their
goal and have the Greedy Guy clean the table. Otherwise the output is “KEK.”

浙公网安备 33010602011771号