#include <bits/stdc++.h>
const long long mod = 1000000007;
using namespace std;
template <typename T>
void printV(vector<T>& v) {
  for (int i = 0; i < (int)(v.size()); i++) cout << v[i] << " ";
  cout << endl;
}
template <typename T>
void printVs(vector<vector<T> >& v) {
  for (int i = 0; i < (int)(v.size()); i++) printV(v[i]);
}
const int N = 600000;
const char aa = 'a';
int main(int argc, const char* argv[]) {
  long long n, k, b;
  cin >> n >> k >> b;
  vector<long long> a(n);
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  vector<long long> s = a;
  s.resize(a.size() - 1);
  sort(s.begin(), s.end(), greater<long long>());
  long long A = 0, B = 0;
  for (int i = 0; i < (int)(k - 1); i++) A += s[i];
  B = s[k - 1];
  int res = n;
  for (int i = n - 2; i >= 0; i--) {
    long long S = A + min(a[i], B);
    if (S > b) res = i + 1;
  }
  cout << res << endl;
}
