#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  long long b;
  while (scanf("%d%d%I64d", &n, &k, &b) >= 1) {
    vector<long long> as(n);
    for (int i = 0; i < n; i++) scanf("%I64d", &as[i]);
    int ans = n - 1;
    multiset<long long, greater<long long> > rs;
    long long rsum = 0;
    for (int i = n - 2; i >= 0; i--) {
      if (rsum + as[i] > b) ans = min(ans, i);
      rs.insert(as[i]);
      rsum += as[i];
      if (((int)(rs).size()) >= k) {
        rsum -= *--rs.end();
        rs.erase(--rs.end());
      }
    }
    printf("%d\n", ans + 1);
  }
  return 0;
}
