#include <bits/stdc++.h>
using namespace std;
struct node {
  int id, fi, v;
} sq[100010];
int cmp(node a, node b) { return a.v > b.v; }
int cmp1(node a, node b) { return a.id < b.id; }
long long res;
int n, m, g[100010];
int solve() {
  int i, j;
  long long tmp, Tmp;
  tmp = 0;
  for (i = 1; i < m; i++) tmp += sq[g[i]].v;
  for (i = 1; i < n; i++) {
    if (sq[i].fi < m)
      Tmp = (long long)(tmp + (long long)sq[g[m]].v);
    else
      Tmp = (long long)(tmp + (long long)sq[i].v);
    if (Tmp > res) break;
  }
  return i;
}
int main() {
  int i, j;
  while (scanf("%d%d", &n, &m) != EOF) {
    scanf("%I64d", &res);
    for (i = 1; i <= n; i++) scanf("%d", &sq[i].v), sq[i].id = i;
    sort(sq + 1, sq + n, cmp);
    for (i = 1; i <= n; i++) {
      g[i] = sq[i].id;
      sq[i].fi = i;
    }
    sort(sq + 1, sq + n, cmp1);
    printf("%d\n", solve());
  }
  return 0;
}
