#include <bits/stdc++.h>
using namespace std;
pair<int, int> cost[111111];
bool okay[111111];
int main(void) {
  int n = 0;
  int k = 0;
  scanf("%d %d", &n, &k);
  long long b = 0;
  scanf("%I64d", &b);
  for (int i = 0; i < n; i++) {
    scanf("%d", &cost[i].first);
    cost[i].second = i;
  }
  cost[n - 1].first = 0;
  sort(cost, cost + n);
  reverse(cost, cost + n);
  long long sum = 0;
  for (int i = 0; i < k; i++) {
    sum += cost[i].first;
    okay[cost[i].second] = true;
  }
  int last = cost[k - 1].first;
  for (int i = 0; i < n; i++) swap(cost[i].first, cost[i].second);
  sort(cost, cost + n);
  int ans = -1;
  if (sum <= b) {
    ans = n - 1;
  } else {
    sum -= last;
    for (int i = 0; i < n; i++) {
      if (okay[i] || sum + cost[i].second > b) {
        ans = i;
        break;
      }
    }
  }
  printf("%d\n", ans + 1);
  return 0;
}
