#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int N = 100000 + 10;
int n;
int x;
int h[N];
int presum[N];
bool check(int y)
{
for (int i = 1; i <= n - y; ++ i)
{
if ((presum[i + y - 1] - presum[i - 1]) < 2 * x) return false;
}
return true;
}
int main()
{
cin >> n >> x;
for (int i = 1; i < n; ++ i)
{
cin >> h[i];
presum[i] = presum[i - 1] + h[i];
}
int l = 1, r = n;
while (l < r)
{
int mid = l + r >> 1;
if (check(mid)) r = mid;
else l = mid + 1;
}
cout << r << endl;
return 0;
}
你简直就是一个天才!