#include <bits/stdc++.h>
using namespace std;
struct Node {
  int c, ind, ran;
} node[110000];
bool cmp(Node a, Node b) { return a.c > b.c; }
int ind[110000];
int f(int n, int k, long long b) {
  long long s = 0, t;
  int i, j;
  for (i = 1; i < k; i++) s += node[ind[i]].c;
  for (i = 1; i < n; i++) {
    if (node[i].ran < k)
      t = s + node[ind[k]].c;
    else
      t = s + node[i].c;
    if (t > b) return i;
  }
  return n;
}
bool cmp1(Node a, Node b) { return a.ind < b.ind; }
int main() {
  long long b;
  int k, n, i, j;
  scanf("%d%d", &n, &k);
  cin >> b;
  for (i = 1; i <= n; i++) scanf("%d", &node[i].c), node[i].ind = i;
  sort(node + 1, node + n, cmp);
  for (i = 1; i <= n; i++) ind[i] = node[i].ind, node[i].ran = i;
  sort(node + 1, node + n, cmp1);
  printf("%d\n", f(n, k, b));
}
