#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);srand(chrono::high_resolution_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ll long long
#define debug(x) cout << '[' << #x << " is: " << x << "] " << endl;
#define debugg(x,y) cout << '[' << #x << " is: " << x << "] " << " " << '[' << #y << " is: " << y << "] ";
#define rsor(v) sort(v.rbegin() , v.rend());
#define rev(v) reverse(v.begin() , v.end());
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define _cout(v) for(auto f : v ) cout << f << " " ;
#define _cin(v) for(auto &it : v)cin >> it ;
#define _for(v) for(int i=0;i<(v);i++)
#define PFD(n) cout.precision(n)<<fixed
#define gc getchar_unlocked
#define vi vector<int>
#define fs first
#define sc second
const long double PI=3.14159265359;
#define int long long
void solve(){
int n,x,t;
cin >> n >> x >> t;
vector<int> d(n+2);
for (int i=0;i<n;i++){
cin >> d[i];
if (i>0)d[i]=d[i-1]+d[i];
}
d[n]=d[n-1]+x;
t%=d[n];
//_cout(d)
if (t==0){
cout << 1 << '\n';
return;
}
int ans = 0;
for (int i=0;i<n+2;i++){
if (d[i]<t && d[i]+x>=t )ans++;
}
cout << ans << '\n';
}
int32_t main() {
IOS;
int _=1;
//cin>>_;
for(int tc=1;tc<=_;tc++){
// cout << "Case #" << tc << ": ";
solve();
}
}
Copy