CF837F.Prefix Sums

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Consider the function p(x)p(x) , where xx is an array of mm integers, which returns an array yy consisting of m+1m+1 integers such that yiy_{i} is equal to the sum of first ii elements of array xx ( 0<=i<=m0<=i<=m ).

You have an infinite sequence of arrays A0,A1,A2...A^{0},A^{1},A^{2}... , where A0A^{0} is given in the input, and for each i>=1i>=1 Ai=p(Ai1)A^{i}=p(A^{i-1}) . Also you have a positive integer kk . You have to find minimum possible ii such that AiA^{i} contains a number which is larger or equal than kk .

输入格式

The first line contains two integers nn and kk ( 2<=n<=2000002<=n<=200000 , 1<=k<=10181<=k<=10^{18} ). nn is the size of array A0A^{0} .

The second line contains nn integers A00,A10... An10A^{0}_{0},A^{0}_{1}...\ A^{0}_{n-1} — the elements of A0A^{0} ( 0<=Ai0<=1090<=A^{0}_{i}<=10^{9} ). At least two elements of A0A^{0} are positive.

输出格式

Print the minimum ii such that AiA^{i} contains a number which is larger or equal than kk .

输入输出样例

  • 输入#1

    2 2
    1 1
    

    输出#1

    1
    
  • 输入#2

    3 6
    1 1 1
    

    输出#2

    2
    
  • 输入#3

    3 1
    1 0 1
    

    输出#3

    0
    
首页