#include <bits/stdc++.h>
using namespace std;
priority_queue<int, vector<int>, greater<int> > PQ;
int a[100010];
inline int Max(int a, int b) { return a > b ? a : b; }
int main() {
  int n, k;
  long long Tot;
  while (scanf("%d%d", &n, &k) != EOF) {
    scanf("%I64d", &Tot);
    for (int i = 1; i <= n; ++i) {
      scanf("%d", &a[i]);
    }
    while (!PQ.empty()) {
      PQ.pop();
    }
    int Ans = n;
    long long Sum = 0;
    --n;
    for (int i = n, t = 0; t < k; ++t, --i) {
      if (i < 1) continue;
      PQ.push(a[i]);
      Sum += a[i];
    }
    if (Sum > Tot) {
      Ans = Max(n - k + 1, 1);
    }
    for (int i = n - k; i >= 1; --i) {
      Sum -= PQ.top();
      PQ.pop();
      Sum += a[i];
      if (Sum > Tot) {
        Ans = i;
      }
      PQ.push(a[i]);
    }
    printf("%d\n", Ans);
  }
  return 0;
}
