#include <bits/stdc++.h>
using namespace std;
long long int modInverse(long long int a, long long int n) {
  long long int i = n, v = 0, d = 1;
  while (a > 0) {
    long long int t = i / a, x = a;
    a = i % x;
    i = x;
    x = d;
    d = v - t * x;
    v = x;
  }
  v %= n;
  if (v < 0) v = (v + n) % n;
  return v;
}
long long power(long long n, long long k) {
  long long t, l;
  if (k % 2)
    t = n;
  else
    t = 1;
  if (k == 1) return n;
  if (!k) return 1;
  return ((l = power(n, k / 2)) * l * t) % 10000007;
}
long long comb(long long n, long long r) {}
int bsearch(int a[], int front, int end, int k) {
  int mid, val = 0, i;
  while (front <= end) {
    mid = (front + end) / 2;
    if (a[mid] == k) {
      i = mid;
      while (a[i] == mid) i--;
      return i;
    } else if (a[mid] > k)
      end = mid - 1;
    else if (a[mid] < k)
      front = mid + 1;
  }
  return -1;
}
struct pos {
  int val;
  int pos;
} posit[100001], q[100001];
bool operator<(pos a, pos b) { return a.val > b.val; }
int main() {
  int n = ({
    int t;
    cin >> t;
    t;
  }),
      k = ({
        int t;
        cin >> t;
        t;
      });
  long long b = ({
    long long t;
    cin >> t;
    t;
  });
  for (int i = 0; i < n; i++)
    posit[i].val = ({
      int t;
      cin >> t;
      t;
    }),
    posit[i].pos = i, q[i] = posit[i];
  sort(posit, posit + n - 1);
  int pos = 0;
  int cnt = 0;
  int minpos = 1e6;
  for (int i = 0; i < k; i++) {
    b -= posit[i].val;
    if (posit[i].pos < minpos) minpos = posit[i].pos;
    if (b < 0) {
      pos = i;
      break;
    }
    cnt++;
  }
  if (cnt == k) {
    cout << n << endl;
  } else {
    b += posit[pos].val;
    for (int i = 0; i < n; i++)
      if (b - q[i].val < 0) {
        minpos = i;
        break;
      }
    if (cnt == k - 1)
      cout << minpos + 1 << endl;
    else
      cout << "1\n";
  }
}
