#include <bits/stdc++.h>
using namespace std;
int n, m;
long long tot, a[1000009], b[1000009];
bool cmp(long long x, long long y) { return x > y; }
int main() {
  cin >> n >> m >> tot;
  if (m == n) {
    cout << n << endl;
    return 0;
  }
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i <= n - 1; i++) b[i] = a[i];
  sort(b + 1, b + n, cmp);
  long long num = 0;
  for (long long i = 1; i <= m - 1; i++) num += b[i];
  for (long long i = 1; i <= n; i++)
    if (a[i] >= b[m]) {
      if (num + b[m] > tot) {
        cout << i << endl;
        return 0;
      }
    } else if (num + a[i] > tot) {
      cout << i << endl;
      return 0;
    }
  cout << n << endl;
  return 0;
}
