#include <bits/stdc++.h>
using namespace std;
int ori[100005];
int sor[100005];
int main() {
  long long int m, sum = 0;
  int n, k;
  cin >> n >> k >> m;
  for (int i = 1; i <= n; i++) scanf("%d", &ori[i]);
  ori[n] = 0;
  memcpy(sor, ori, sizeof(ori));
  sort(sor + 1, sor + n + 1, greater<int>());
  for (int i = 1; i < k; i++) sum += sor[i];
  bool flag = 1;
  long long int tmp;
  for (int i = 1; i < n; i++) {
    tmp = sum;
    if (ori[i] >= sor[k])
      tmp += sor[k];
    else
      tmp += ori[i];
    if (tmp > m) {
      cout << i;
      flag = 0;
      break;
    }
  }
  if (flag) cout << n;
  return 0;
}
