#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000000;
const int MAXN = 100100;
pair<int, int> a[MAXN];
int A[MAXN];
bool got[MAXN];
int main() {
  int n, k;
  long long b;
  cin >> n >> k;
  cin >> b;
  for (int i = 0; i < (n); ++i) {
    int v;
    cin >> v;
    a[i] = make_pair(v, i);
    A[i] = v;
  }
  sort(a, a + n - 1);
  reverse(a, a + n - 1);
  long long sum = 0;
  for (int i = 0; i < (k); ++i) {
    sum += a[i].first;
    got[a[i].second] = true;
  }
  for (int i = 0; i < (n); ++i) {
    if (got[i]) {
      if (sum > b) {
        printf("%d\n", i + 1);
        return 0;
      }
    } else {
      if (sum - a[k - 1].first + A[i] > b) {
        printf("%d\n", i + 1);
        return 0;
      }
    }
  }
  printf("%d\n", n);
  return 0;
}
