#include <bits/stdc++.h>
using namespace std;
int n, k;
long long acc[300000];
long long v[300000], money;
int main() {
  multiset<int> S;
  long long soma = 0;
  cin >> n >> k;
  cin >> money;
  for (int i = 0; i < n; i++) cin >> v[i];
  k--;
  if (k == 0) {
    int ans = n;
    for (int i = 0; i < n; i++) {
      if (v[i] > money) {
        ans = i;
        break;
      }
    }
    printf("%d\n", ans + 1);
    return 0;
  }
  acc[n - 2] = soma;
  soma = v[n - 2];
  S.insert(soma);
  for (int i = n - 3; i >= 0; i--) {
    acc[i] = soma;
    if (S.size() < k) {
      S.insert(v[i]);
      soma += v[i];
    } else if (*(S.begin()) < v[i]) {
      int aux = *(S.begin());
      S.erase(S.begin());
      S.insert(v[i]);
      soma += v[i], soma -= aux;
    }
  }
  int ans = n - 1;
  for (int i = 0; i < n; i++) {
    if (acc[i] + v[i] > money) {
      ans = i;
      break;
    }
  }
  printf("%d\n", ans + 1);
  return 0;
}
