#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  long long b;
  cin >> n >> k >> b;
  int a[100004];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  priority_queue<int> q;
  long long sum = 0;
  if (k == 1) {
    for (int i = 0; i < n - 1; ++i)
      if (a[i] > b) {
        cout << i + 1 << endl;
        return 0;
      }
    cout << n << endl;
    return 0;
  }
  int best = n - 1;
  sum = 0;
  for (int i = n - k; i <= n - 2; ++i) {
    q.push(-a[i]);
    sum += a[i];
  }
  if (sum + a[n - k - 1] > b) {
    best = n - k - 1;
  }
  for (int i = n - k - 1; i > 0; --i) {
    if (a[i] >= -q.top()) {
      sum += (a[i] + q.top());
      q.pop();
      q.push(-a[i]);
    }
    if (sum + a[i - 1] > b) best = i - 1;
  }
  cout << best + 1 << endl;
}
