#include <bits/stdc++.h>
using namespace std;
long long labs(long long a) { return a < 0 ? (-a) : a; }
vector<pair<long long, long long> > v;
vector<long long> c;
vector<bool> was;
int main() {
  int n, k;
  cin >> n >> k;
  long long b;
  cin >> b;
  v.resize(n);
  c.resize(n);
  for (int(i) = 0; (i) < (n); (i)++) {
    cin >> c[i];
    v[i].first = c[i];
    v[i].second = i;
  }
  v.pop_back();
  sort((v).begin(), (v).end());
  reverse((v).begin(), (v).end());
  was.assign(n, false);
  long long sum = 0;
  for (int(i) = 0; (i) < (k - 1); (i)++) {
    was[v[i].second] = true;
    sum += v[i].first;
  }
  int res = n - 1;
  for (int(i) = 0; (i) < (n); (i)++) {
    if (was[i]) {
      if (sum + v[k - 1].first > b) {
        res = min(i, res);
      }
    } else {
      if (sum + c[i] > b) {
        res = min(i, res);
      }
    }
  }
  cout << res + 1 << endl;
  return 0;
}
