#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > A;
vector<long long> PS;
long long b;
int N, K;
int position_in_sorting_massive[1000000];
int main() {
  cin >> N >> K >> b;
  A.resize(N);
  PS.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i].first;
    A[i].second = -i;
  }
  A.pop_back();
  sort(A.rbegin(), A.rend());
  for (int i = 0; i < N - 1; i++) {
    PS[i] += A[i].first;
    if (i) PS[i] += PS[i - 1];
  }
  for (int i = 0; i < N - 1; i++) {
    position_in_sorting_massive[-A[i].second] = i;
  }
  for (int i = 0; i < N - 1; i++) {
    long long sum = 0;
    if (position_in_sorting_massive[i] < K)
      sum = PS[K - 1];
    else
      sum = (K - 2 >= 0 ? PS[K - 2] : 0) +
            A[position_in_sorting_massive[i]].first;
    if (sum > b) {
      cout << i + 1 << endl;
      return 0;
    }
  }
  cout << N << endl;
  return 0;
}
