#include <bits/stdc++.h>
using namespace std;
const int maxN = 100010;
struct city {
  long long m;
  int id;
} b[maxN];
long long a[maxN];
int n, k, ans;
long long d, sum;
bool vis[maxN];
bool cmp(const city &a, const city &b) {
  if (a.m != b.m) return a.m > b.m;
  return a.id > b.id;
}
int main() {
  while (scanf("%d%d", &n, &k) != EOF) {
    scanf("%I64d", &d);
    for (int i = 0; i < n; i++) {
      scanf("%I64d", &a[i]);
      b[i].m = a[i];
      b[i].id = i;
    }
    n--, k--;
    sort(b, b + n, cmp);
    memset(vis, false, sizeof(vis));
    sum = 0;
    for (int i = 0; i < k; i++) {
      sum += b[i].m;
      vis[b[i].id] = true;
    }
    ans = n + 1;
    for (int i = 0; i < n; i++) {
      if (vis[i] && k > 0) sum = sum - a[i] + b[k].m;
      if (sum + a[i] > d) {
        ans = i + 1;
        break;
      }
      if (vis[i] && k > 0) sum = sum + a[i] - b[k].m;
    }
    printf("%d\n", ans);
  }
  return 0;
}
