#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:20000000")
using namespace std;
int ri() {
  int x;
  scanf("%d", &x);
  return x;
}
long long rll() {
  long long x;
  scanf("%lld", &x);
  return x;
}
const int MAXN = 1e5 + 10;
pair<int, int> mas[MAXN];
int in[MAXN];
void solve() {
  int n = ri(), k = ri();
  long long b;
  cin >> b;
  long long sum = 0;
  for (int i = (int)(1); i <= (int)(n); i++)
    mas[i].first = ri(), sum += (long long)mas[i].first, mas[i].second = i,
    in[i] = mas[i].first;
  sum -= (long long)mas[n].first;
  sort(mas + 1, mas + n);
  set<pair<int, int> > st;
  set<pair<int, int> >::iterator it;
  long long su = 0;
  for (int i = (int)(n - 1); i >= (int)(n - k + 1); i--)
    st.insert(mas[i]), su += (long long)mas[i].first;
  int dop = n - k;
  if (dop < 0) dop = 0;
  for (int i = (int)(1); i <= (int)(n - 1); i++) {
    if (st.find(make_pair(in[i], i)) == st.end()) {
      if (su + (long long)in[i] > b) {
        cout << i << endl;
        return;
      }
    } else {
      su -= (long long)in[i];
      st.erase(make_pair(in[i], i));
      su += (long long)mas[dop].first;
      st.insert(make_pair(mas[dop].first, mas[dop].second));
      if (su + (long long)in[i] > b) {
        cout << i << endl;
        return;
      }
      st.erase(make_pair(mas[dop].first, mas[dop].second));
      su -= (long long)mas[dop].first;
      st.insert(make_pair(in[i], i));
      su += (long long)in[i];
    }
    if (!st.empty() && st.begin()->first < in[i] &&
        st.find(make_pair(in[i], i)) == st.end()) {
      su -= (long long)st.begin()->first;
      st.erase(st.begin());
      su += (long long)in[i];
      st.insert(make_pair(in[i], i));
    }
  }
  cout << n << endl;
}
int main() {
  solve();
  return 0;
}
