#include <bits/stdc++.h>
using namespace std;
void Solve() {
  long long i, n, k, magic = 0, answer, left, add, tm;
  long long b;
  cin >> n >> k;
  answer = n - 1;
  cin >> b;
  vector<long long> a(n);
  vector<pair<long long, long long> > temp(n - 1);
  set<long long> was;
  set<long long>::iterator pos;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (i != n - 1) {
      temp[i] = make_pair(a[i], i);
    }
  }
  sort(temp.begin(), temp.end());
  for (i = n - 2; i >= n - k; i--) {
    magic += temp[i].first;
    was.insert(temp[i].second);
  }
  add = temp[n - k - 1].first;
  tm = magic;
  for (i = n - 1; i >= 0; i--) {
    pos = was.lower_bound(i);
    if (pos != was.end() && *pos == i) {
      magic -= a[i];
      magic += add;
    }
    left = b - magic;
    if (left < a[i]) answer = i;
    magic = tm;
  }
  cout << ++answer << "\n";
}
int main() {
  Solve();
  return 0;
}
