AYJCC24 P1 - Can Jimmy Cut?


Submit solution


Points: 3 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
Assembly, Awk, Brain****, C, C++, Java, Lua, Pascal, Perl, PyPy 2, PyPy 3, Python, Sed

Jimmy has an issue. He's been trying to cut but he doesn't seem to lose any weight. Each time he eats, unknown to him, a special chili sauce he used is making him consume too many calories.

Given \(N\) days with meals, with the \(i\)-th day having \(a_i\) calories, and a daily loss of \(K\) calories due to metabolism, determine if Jimmy has a calorie deficit after the \(N\) days.

Constraints

Subtask 1 [60%]

\(1 \le N, K, a_{i} \le 10 ^ 4\)

Subtask 2 [40%]

\(1 \le N \le 10 ^ 6\)

\(1 \le K, a_{i} \le 10 ^ 9\)

Input Specification

The first line will contain two space seperated integers, \(N\) and \(K\). The next \(N\) lines contain one integer per line, the calories eaten each day.

Output Specification

Output Jimmy's calorie deficit and NO if he gained calories.

Sample Input

6 4
4 
2
7
3
6
1

Sample Output

1

Explanation for Sample Output

Jimmy has a calorie deficit of \(1\) over the \(6\) days.


Comments

There are no comments at the moment.