#include <bits/stdc++.h>
using namespace std;
int n, k, i, g[120000], tree[120000], ans, s[120000];
long long sum[120000], f[120000], b;
long long back(int x) {
  long long ans = 0;
  while (x > 0) {
    ans += sum[x];
    x -= x & (-x);
  }
  return ans;
}
void add(int x, long long p) {
  while (x <= n) {
    sum[x] += p;
    tree[x]++;
    x += x & (-x);
  }
}
bool cmp(int a, int b) { return f[a] > f[b]; }
int nth() {
  int x, now, i;
  x = k - 1;
  if (k == 1) return 0;
  now = 0;
  for (i = 20; i >= 0; i--) {
    now |= (1 << i);
    if (now > n || tree[now] >= x) {
      now ^= (1 << i);
    } else
      x -= tree[now];
  }
  return now + 1;
}
int main() {
  scanf("%d%d", &n, &k);
  scanf("%I64d", &b);
  memset(sum, 0, sizeof(sum));
  memset(tree, 0, sizeof(tree));
  for (i = 1; i <= n; i++) {
    scanf("%I64d", &f[i]);
    g[i] = i;
  }
  sort(g + 1, g + 1 + n, cmp);
  for (i = 1; i <= n; i++) s[g[i]] = i;
  ans = n;
  for (i = n - 1; i > n - k + 1; i--) {
    add(s[i], f[i]);
  }
  for (i = n - k + 1; i > 0; i--) {
    if (back(nth()) + f[i] > b) ans = i;
    add(s[i], f[i]);
  }
  printf("%d\n", ans);
  return 0;
}
