#include <bits/stdc++.h>
using namespace std;
int N, K;
long long S;
long long a[100010], b[100010];
int main(void) {
  int i;
  cin >> N >> K >> S;
  for ((i) = 0; (i) < (int)(N); (i)++) cin >> a[i];
  for ((i) = 0; (i) < (int)(N - 1); (i)++) b[i] = a[i];
  sort(b, b + N - 1);
  int low = -1, high = N - 1;
  while (high - low > 1) {
    int mid = (high + low) / 2;
    long long sum = 0;
    int cnt = K - 1;
    for (i = N - 2; i >= 0; i--) {
      if (i == mid) {
        sum += b[i];
      } else if (cnt > 0) {
        cnt--;
        sum += b[i];
      }
    }
    if (sum > S)
      high = mid;
    else
      low = mid;
  }
  int ans = N - 1;
  if (high != N - 1)
    for ((i) = 0; (i) < (int)(N - 1); (i)++)
      if (a[i] >= b[high]) ans = min(ans, i);
  cout << ans + 1 << endl;
  return 0;
}
