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