#include <bits/stdc++.h>
using namespace std;
int c[100048], z[100048];
bool ord(int a, int b) { return c[a] > c[b]; }
int main(void) {
  for (int i, n, k; cin >> n >> k;) {
    long long int m, s = 0;
    cin >> m;
    for (i = 0; i < n; ++i) cin >> c[i], z[i] = i;
    sort(z, z + n - 1, ord);
    for (i = 0; i < k; ++i) s += c[z[i]];
    if (s <= m)
      cout << n << endl;
    else {
      for (i = 0; i < n; ++i)
        if (s - c[z[k - 1]] + c[i] > m) break;
      cout << (i + 1) << endl;
    }
  }
  return 0;
}
