#include <bits/stdc++.h>
using namespace std;
const int N = 100048;
int c[N], inord[N];
bool used[N];
bool ord(int a, int b) { return c[a] > c[b]; }
int main(void) {
  for (int n, k; scanf("%d %d", &n, &k) == 2;) {
    long long int money, spent = 0;
    int ans = n - 1;
    cin >> money;
    for (int i = 0; i < n; ++i) {
      scanf("%d", c + i);
      inord[i] = i;
      used[i] = false;
    }
    sort(inord, inord + n - 1, ord);
    for (int i = 0; i < k; ++i) {
      spent += c[inord[i]];
      used[inord[i]] = true;
    }
    if (spent <= money)
      printf("%d\n", n);
    else {
      ans = inord[k - 1];
      for (int i = 0; i < n; ++i) {
        if (spent - c[inord[k - 1]] + c[i] > money) {
          ans = i;
          break;
        }
      }
      printf("%d\n", ans + 1);
    }
  }
  return 0;
}
