#include <bits/stdc++.h>
using namespace std;
struct p {
  long long val;
  int id;
};
long long arr[100100];
p x[100100];
bool vis[100100];
bool comp(p a, p b) {
  if (a.val > b.val) return true;
  if (a.val < b.val) return false;
  return a.id > b.id;
}
int main() {
  ios::sync_with_stdio(false);
  int n, k;
  long long disp, sum = 0;
  cin >> n >> k;
  cin >> disp;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    x[i].val = arr[i];
    x[i].id = i;
  }
  sort(x, x + n - 1, comp);
  for (int i = 0; i < k - 1; i++) {
    sum += x[i].val;
    vis[x[i].id] = true;
  }
  int ans = n;
  for (int i = 0; i < n - 1; i++) {
    if (vis[i]) {
      if (sum + x[k - 1].val > disp) {
        ans = i + 1;
        break;
      }
    } else {
      if (sum + arr[i] > disp) {
        ans = i + 1;
        break;
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
