#include <bits/stdc++.h>
using namespace std;
long long n, k, a[100000], b;
int ord[100000];
vector<pair<long long, int>> v;
int main(int argc, char const *argv[]) {
  scanf("%lld%lld", &n, &k);
  scanf("%lld", &b);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
    if (i != n - 1) v.push_back({a[i], i});
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  for (int i = 0; i < n - 1; i++) {
    ord[v[i].second] = i;
  }
  long long x = 0, y = 0;
  for (int i = 0; i < k - 1; i++) {
    x += v[i].first;
  }
  y = x + v[k - 1].first;
  for (int i = 0; i < n - 1; i++) {
    long long cur = x;
    if (ord[i] < k - 1) {
      cur = y;
    } else {
      cur = x + a[i];
    }
    if (b < cur) {
      printf("%d\n", i + 1);
      return 0;
    }
  }
  printf("%lld\n", n);
  return 0;
}
