#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > all;
int isable[100005], cnt[100005];
int main() {
  int i, n, k;
  scanf("%d", &n);
  scanf("%d", &k);
  long long b;
  scanf("%I64d", &b);
  for (i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    cnt[i] = x;
    if (i != n - 1) all.push_back(make_pair(x, i));
  }
  sort(all.begin(), all.end());
  i = all.size() - 1;
  long long sm = 0;
  int choto;
  while (k) {
    sm += all[i].first;
    choto = all[i].first;
    isable[all[i].second] = 1;
    k--;
    i--;
  }
  for (i = 0; i < n - 1; i++) {
    long long temp = sm;
    if (!isable[i]) {
      temp -= choto;
      temp += cnt[i];
    }
    if (temp > b) break;
  }
  printf("%d\n", i + 1);
  return 0;
}
