//EGOI 2023 Candy
//https://qoj.ac/contest/1355/problem/7159
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
const ll MAXN = 105;
const ll MAXN2 = 105*105;
int main(){
ll n, f, t, tot=0, ans=1e18;
cin >> n >> f >> t;
vll A(n); vvll dp1(MAXN,vll(MAXN2,1e18)), dp2(MAXN,vll(MAXN2,0)); dp1[0][0]=0;
for(int i=0; i<n; i++) cin >> A[i];
for(int i=0; i<f; i++){
vvll ndp=dp1; tot+=A[i];
for(int cnt=0; cnt<MAXN-1; cnt++) for(int j=0; j<MAXN2; j++){
if(j+f-i<MAXN2) ndp[cnt+1][j+f-i]=min(ndp[cnt+1][j+f-i],dp1[cnt][j]+A[i]);
}
swap(dp1,ndp);
}
for(int i=f; i<n; i++){
vvll ndp=dp2;
for(int cnt=0; cnt<MAXN-1; cnt++) for(int j=0; j<MAXN2; j++){
if(j+i-f<MAXN2) ndp[cnt+1][j+i-f]=max(ndp[cnt+1][j+i-f],dp2[cnt][j]+A[i]);
}
swap(dp2,ndp);
}
for(int cnt=0; cnt<MAXN; cnt++) for(int j=1; j<MAXN2; j++){
dp1[cnt][j]=min(dp1[cnt][j],dp1[cnt][j-1]); dp2[cnt][j]=max(dp2[cnt][j],dp2[cnt][j-1]);
}
for(int cnt=0; cnt<MAXN; cnt++) for(int j=0; j<MAXN2; j++){
ll x=t+dp1[cnt][j]-tot, l=0, r=MAXN2-1;
while(l<r){
ll m=(l+r)/2;
if(dp2[cnt][m]>=x) r=m;
else l=m+1;
}
if(dp2[cnt][l]>=x) ans=min(ans,j+l);
}
if(ans==1e18) cout << "NO\n";
else cout << ans << "\n";
}