#include <bits/stdc++.h>
using namespace std;
const int maxn = 100100;
int p[maxn], a[maxn], Rk[maxn], N, D;
long long M, Sum;
bool Cmp(const int &A, const int &B) { return a[A] > a[B]; }
int main() {
  scanf("%d%d%I64d", &N, &D, &M);
  for (int i = 0; i < N; ++i) scanf("%d", &a[i]), p[i] = i;
  sort(p, p + N - 1, Cmp);
  for (int i = 0; i < N - 1; ++i) Rk[p[i]] = i;
  for (int i = 0; i < D - 1; ++i) Sum += a[p[i]];
  for (int i = 0; i < N - 1; ++i)
    if (Rk[i] <= D - 1 && Sum + a[p[D - 1]] > M ||
        Rk[i] >= D && Sum + a[i] > M) {
      printf("%d\n", i + 1);
      return 0;
    }
  printf("%d\n", N);
  return 0;
}
