#include <bits/stdc++.h>
using namespace std;
const int N = 210000;
int n, k;
long long money;
int ar[N];
vector<pair<int, int> > v;
long long pref;
int ans;
long long topay;
int at[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  cin >> money;
  for (int i = 1; i <= n; i++) {
    cin >> ar[i];
    if (i < n) v.push_back(make_pair(ar[i], i));
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) {
    at[v[i].second] = i;
  }
  for (int i = 0; i < k; i++) pref += v[i].first;
  ans = n;
  for (int i = 1; i < n; i++) {
    if (at[i] <= k - 1)
      topay = pref - ar[i];
    else
      topay = pref - v[k - 1].first;
    if (topay + ar[i] > money) ans = min(ans, i);
  }
  cout << ans << endl;
  return 0;
}
