#include <bits/stdc++.h>
using namespace std;
long long a[100005], b;
int n, k;
pair<long long, int> pvec[100005];
int solve() {
  for (int i = 0; i < n - 1; i++) pvec[i] = make_pair(a[i], i + 1);
  sort(pvec, pvec + n);
  reverse(pvec, pvec + n);
  long long total = 0;
  int ans = n;
  for (int i = 0; i < k; i++) {
    total += pvec[i].first;
    ans = min(ans, pvec[i].second);
  }
  if (total > b) {
    if (k > 1) b = b - (total - pvec[k - 1].first);
    for (int j = 0; j < n; j++) {
      if (a[j] > b) return j + 1;
    }
  } else
    return n;
  return 0;
}
int main() {
  cin >> n >> k;
  cin >> b;
  for (int i = 0; i < n; i++) cin >> a[i];
  cout << solve() << endl;
  return 0;
}
