#include <bits/stdc++.h>
int n, k;
long long b;
std::pair<int, int> ary[100010];
int pri[100010], ord[100010];
int cmp(std::pair<int, int> a, std::pair<int, int> b) {
  return a.first == b.first ? a.second > b.second : a.first > b.first;
}
int main(void) {
  scanf("%d%d%I64d", &n, &k, &b);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &pri[i]);
    ary[i].first = pri[i], ary[i].second = i;
  }
  std::sort(ary + 1, ary + n, cmp);
  for (int i = 1; i <= n; ++i) ord[ary[i].second] = i;
  long long sum = 0;
  for (int i = 1; i <= k - 1; ++i) sum += ary[i].first;
  int ans;
  for (ans = 1; ans < n; ++ans) {
    if (ord[ans] <= k - 1) {
      if (pri[ans] > b - (sum - pri[ans] + ary[k].first)) break;
    } else {
      if (pri[ans] > b - sum) break;
    }
  }
  printf("%d\n", std::min(ans, n));
  return 0;
}
