#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int a[MAXN];
multiset<long long> ms;
int main() {
  long long n, m, b;
  cin >> n >> m >> b;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  long long s = 0;
  int c = n - 1;
  for (int i = n - 2; i >= 0; --i) {
    s += a[i];
    ms.insert(a[i]);
    if (s > b) {
      c = i;
    }
    if (ms.size() >= m) {
      s -= *ms.begin();
      ms.erase(ms.begin());
    }
  }
  cout << (c + 1) << endl;
}
