#include <bits/stdc++.h>
using namespace std;
const int pi = acos(-1.0);
const int N = 200000 + 3;
long long b, sum, c[N];
pair<int, int> a[N];
int n, k;
bool v[N];
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> k >> b;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i].first;
    a[i].second = i;
    c[i] = a[i].first;
  }
  sort(a + 1, a + n);
  for (int i = n - 1; i > n - k - 1; --i) sum += a[i].first;
  int res;
  if (sum <= b)
    res = n;
  else {
    sum = 0;
    for (int i = n - 1; i > n - k - 1; --i)
      if (sum + a[i].first > b)
        break;
      else {
        sum += a[i].first;
        v[a[i].second] = true;
      }
    for (int i = 1; i <= n; ++i)
      if (v[i] || sum + c[i] > b) {
        res = i;
        break;
      }
  }
  printf("%d\n", res);
  return 0;
}
