#include <bits/stdc++.h>
using namespace std;
int a[100005], n, k;
long long b;
priority_queue<int> Q;
int main() {
  scanf("%d%d%lld", &n, &k, &b);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  k--;
  int ans = n;
  for (int i = n - 2; i >= 0; i--) {
    if (b < a[i]) ans = i + 1;
    if (Q.size() < k) {
      Q.push(-a[i]);
      b -= a[i];
    } else if (!Q.empty() && a[i] > -Q.top()) {
      b -= Q.top();
      Q.pop();
      Q.push(-a[i]);
      b -= a[i];
    }
  }
  printf("%d\n", ans);
  return 0;
}
