#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)1e6;
int a[maxn], pos[maxn];
pair<int, int> b[maxn];
long long B;
int n, k;
int main() {
  scanf("%d%d", &n, &k);
  scanf("%d", &B);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    if (i != n - 1) b[i] = make_pair(a[i], i);
  }
  sort(b, b + n);
  reverse(b, b + n);
  for (int i = 0; i < n; ++i) {
    pos[b[i].second] = i;
  }
  long long sum = 0;
  for (int i = 0; i < k - 1; ++i) sum += b[i].first;
  for (int i = 0; i < n; ++i) {
    long long sumt = sum + a[i];
    if (pos[i] < k - 1) sumt += -a[i] + b[k - 1].first;
    if (sumt > B) {
      cout << i + 1 << endl;
      return 0;
    }
  }
  cout << n << endl;
  return 0;
}
