Suffering

View as PDF

Submit solution

Points: 100
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

Josh does not like research. He models the n FIT2083 classes of the semester as an array, where a_i is the number of Depression Points he gains from attending the ith class.

If the total number of Depression Points from a consecutive block of classes becomes strictly greater than k, Josh will die. Determine the smallest number of consecutive classes he can attend and die as a result. If no such block exists, output -1.

Input

The first line contains two integers n and k.

The second line contains n positive integers a_1, a_2, \dots, a_n.

Output

Print a single integer: the minimum length of a contiguous subarray whose sum is strictly greater than k. If no such subarray exists, print -1.

Constraints

  • 1 \le n \le 10^5
  • 1 \le a_i \le 10^3
  • 1 \le k \le 10^9

Example 1

Input
5 11
5 10 1 4 5
Output
2
Explanation

The shortest valid subarray is [5, 10], whose sum is 15 > 11.


Comments

There are no comments at the moment.