CF839A.Arya and Bran

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Bran and his older sister Arya are from the same house. Bran like candies so much, so Arya is going to give him some Candies.

At first, Arya and Bran have 00 Candies. There are nn days, at the ii -th day, Arya finds aia_{i} candies in a box, that is given by the Many-Faced God. Every day she can give Bran at most 88 of her candies. If she don't give him the candies at the same day, they are saved for her and she can give them to him later.

Your task is to find the minimum number of days Arya needs to give Bran kk candies before the end of the nn -th day. Formally, you need to output the minimum day index to the end of which kk candies will be given out (the days are indexed from 1 to nn ).

Print -1 if she can't give him kk candies during nn given days.

输入格式

The first line contains two integers nn and kk ( 1<=n<=1001<=n<=100 , 1<=k<=100001<=k<=10000 ).

The second line contains nn integers a1,a2,a3,...,ana_{1},a_{2},a_{3},...,a_{n} ( 1<=ai<=1001<=a_{i}<=100 ).

输出格式

If it is impossible for Arya to give Bran kk candies within nn days, print -1.

Otherwise print a single integer — the minimum number of days Arya needs to give Bran kk candies before the end of the nn -th day.

输入输出样例

  • 输入#1

    2 3
    1 2
    

    输出#1

    2
  • 输入#2

    3 17
    10 10 10
    

    输出#2

    3
  • 输入#3

    1 9
    10
    

    输出#3

    -1

说明/提示

In the first sample, Arya can give Bran 33 candies in 22 days.

In the second sample, Arya can give Bran 1717 candies in 33 days, because she can give him at most 88 candies per day.

In the third sample, Arya can't give Bran 99 candies, because she can give him at most 88 candies per day and she must give him the candies within 11 day.

首页