#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int INF= 1e9+7;
ll n,k,res,a[1000005],bit[1000005];
// fenwick tree
void update(ll x,ll val){
for(;x<=1000005;x+=x&-x) bit[x]=min(bit[x],val);
}
ll get(ll x){
ll res=INF;
for(;x>0;x-=x&-x) res=min(res,bit[x]);
return res;
}
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> n >> k;
vector<ll> f(n+1,0);
for(int i=1;i<=n;++i) cin >> a[i],a[i]-=k;
for(int i=1;i<=n;++i) a[i]=f[i]=f[i-1]+a[i];
memset(bit,INF,sizeof(bit));
// nén giá trị
sort(f.begin()+1,f.end());
f.resize(unique(f.begin(),f.end())-f.begin());
for(int i=1;i<=n;++i) a[i]=lower_bound(f.begin()+1,f.end(),a[i])-f.begin()+1;
update(a[1],1);
for(ll i=2;i<=n;++i){
ll id=get(a[i]);
update(a[i],i);
res=max(res,i-id);
}
cout << res;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgbGwgbG9uZyBsb25nCmNvbnN0IGludCBJTkY9IDFlOSs3OwpsbCBuLGsscmVzLGFbMTAwMDAwNV0sYml0WzEwMDAwMDVdOwovLyBmZW53aWNrIHRyZWUKdm9pZCB1cGRhdGUobGwgeCxsbCB2YWwpewogICAgZm9yKDt4PD0xMDAwMDA1O3grPXgmLXgpIGJpdFt4XT1taW4oYml0W3hdLHZhbCk7Cn0KbGwgZ2V0KGxsIHgpewogICAgbGwgcmVzPUlORjsKICAgIGZvcig7eD4wO3gtPXgmLXgpIHJlcz1taW4ocmVzLGJpdFt4XSk7CiAgICByZXR1cm4gcmVzOwp9CmludCBtYWluKCl7CiAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKDApO2Npbi50aWUoMCk7Y291dC50aWUoMCk7CiAgICBjaW4gPj4gbiA+PiBrOwogICAgdmVjdG9yPGxsPiBmKG4rMSw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