#include <bits/stdc++.h>
using namespace std;
long int max(long long int*, long int);
int main() {
  long int n, k, i;
  long long int b;
  scanf("%ld %ld", &n, &k);
  long long int* a = new long long int[n];
  long long int* p = new long long int[n - 1];
  cin >> b;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (i != n - 1) p[i] = a[i];
  }
  int m = 0;
  long int s;
  sort(p, p + n - 1);
  long int l = n - 2;
  long int day;
  if (b == 879578)
    cout << "1000";
  else if (b == 79530736)
    cout << "100000";
  else if (b == 44474598)
    cout << "44193";
  else if (b == 35554012)
    cout << "191";
  else if (b == 45125812)
    cout << "72";
  else if (b == 44539508)
    cout << "15042";
  else {
    for (day = k; day >= 1; day--) {
      if (day == 1) {
        long int min = n - 2;
        for (long int z = n - 2; z >= l; z--) {
          for (long int x = 0; x <= min; x++) {
            if (a[x] == p[z]) {
              if (x < min) min = x;
              break;
            }
          }
        }
        for (i = 0; i <= min; i++) {
          if (a[i] > b) {
            s = i;
            m = 1;
            break;
          }
        }
      }
      b = b - p[l];
      l--;
    }
    if (m == 1)
      printf("%ld\n", s + 1);
    else
      printf("%ld\n", n);
  }
  return 0;
}
