#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, int> > costs;
int main() {
  int n, k;
  long long b;
  cin >> n >> k >> b;
  for (int i = 1; i <= n; i++) {
    long long c;
    cin >> c;
    costs.push_back(make_pair(c, i));
  }
  sort(costs.begin(), costs.end());
  int best = n;
  int done = -1;
  for (int i = costs.size() - 1; i >= 0; i--) {
    if (costs[i].second == n) {
      continue;
    }
    if (k == 0) {
      break;
    }
    if (b >= costs[i].first) {
      b -= costs[i].first;
      k--;
      if (k > 0) {
        best = best > costs[i].second ? costs[i].second : best;
      }
    } else {
      best = best > costs[i].second ? costs[i].second : best;
      done = 1;
    }
  }
  if (done == 1) {
    cout << best << endl;
  } else {
    cout << n << endl;
  }
}
