407952: GYM102948 B Rapid Jaguar

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Rapid Jaguartime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

You are being chased by a rapid, rabid jaguar! Luckily, you are a fast runner, but you won't be able to outrun the jaguar forever. In an effort to get the jaguar off your tail, you run past $$$n$$$ thorny bushes, which you must travel through in order, each of which has some number of thorns, that you hope the jaguar will get caught in so that it can't chase you. Thankfully, your trusty rain jacket renders you immune to the thorns' effects.

The jaguar is willing to keep pursuing you as long as it encounters strictly less than $$$k$$$ thorns. Upon going through $$$k$$$ or more thorns, the jaguar will stop and search for easier prey. You have a limited stamina and want to know how best to pace yourself. How many bushes do you need to run through to escape the jaguar (if it is even possible to do so)?

Note that you won't skip over any bushes because you want to shake off the jaguar as soon as possible.

Input

The first line will consist of two integers $$$n$$$ $$$(1 \leq n \leq 10^5)$$$ and $$$k$$$ $$$(1 \leq k \leq 10^7)$$$ giving the number of thorny bushes and the thorn limit for the jaguar. The next line will consist of $$$n$$$ space separated integers, $$$a_i$$$ $$$(1 \leq a_i \leq 100)$$$, giving the number of thorns on bush $$$i$$$.

Output

Output a single integer giving the number of bushes you need to run through to escape the jaguar. If it is not possible to escape the jaguar, output $$$-1$$$ instead.

ExamplesInput
3 5
1 1 1
Output
-1
Input
3 5
1 2 3
Output
3

加入题单

算法标签: