#include <bits/stdc++.h>
using namespace std;
const double pi =
    3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
set<pair<int, int> > S, S1;
int a[100010];
int main() {
  int n, k;
  long long b;
  scanf("%d%d%lld", &n, &k, &b);
  for (int i = 0; i < (n); ++i) scanf("%d", &a[i]);
  if (k == 1) {
    for (int i = 0; i < (n - 1); ++i)
      if (a[i] > b) {
        printf("%d\n", i + 1);
        return 0;
      }
    printf("%d\n", n);
    return 0;
  }
  long long sum = 0;
  for (int i = (1); i < (n - 1); ++i)
    if ((int)S.size() < k - 1) {
      S.insert(make_pair(a[i], i));
      sum += a[i];
    } else {
      set<pair<int, int> >::iterator it = S.begin();
      if (it->first < a[i]) {
        S1.insert(*it);
        sum -= it->first;
        S.erase(it);
        sum += a[i];
        S.insert(make_pair(a[i], i));
      } else
        S1.insert(make_pair(a[i], i));
    }
  if (sum + a[0] > b) {
    printf("1\n");
    return 0;
  }
  for (int i = (1); i < (n - 1); ++i) {
    S1.insert(make_pair(a[i - 1], i - 1));
    if (S.find(make_pair(a[i], i)) != S.end()) {
      sum -= a[i];
      S.erase(make_pair(a[i], i));
      set<pair<int, int> >::iterator it = S1.end();
      it--;
      sum += it->first;
      S.insert(*it);
      S1.erase(it);
    } else {
      S1.erase(make_pair(a[i], i));
      set<pair<int, int> >::iterator it = S.begin();
      set<pair<int, int> >::iterator it1 = S1.end();
      it1--;
      if (it->first < it1->first) {
        sum += it1->first - it->first;
        S.insert(*it1);
        S1.insert(*it);
        S.erase(it);
        S1.erase(it1);
      }
    }
    if (sum + a[i] > b) {
      printf("%d\n", i + 1);
      return 0;
    }
  }
  printf("%d\n", n);
  return 0;
}
