#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, i;
} no[100010];
long long a[100010];
int tag[100010];
int cmp(node a, node b) { return a.x > b.x; }
int main() {
  int n, k;
  long long b, s1, s2;
  while (scanf("%d%d", &n, &k) != EOF) {
    cin >> b;
    s1 = s2 = 0;
    memset(tag, 0, sizeof(tag));
    for (int i = 0; i < n; i++) {
      int x;
      scanf("%d", &x);
      a[i] = x;
      no[i].x = x, no[i].i = i;
    }
    sort(no, no + n - 1, cmp);
    for (int i = 0; i < k; i++) {
      tag[no[i].i] = 1;
      s1 += no[i].x;
    }
    s2 = s1 - no[k - 1].x;
    int ret = -1;
    for (int i = 0; i < n; i++) {
      if (tag[i]) {
        if (s1 > b) {
          ret = i + 1;
          break;
        }
      } else if (s2 + a[i] > b) {
        ret = i + 1;
        break;
      }
    }
    if (ret == -1) ret = n;
    printf("%d\n", ret);
  }
  return 0;
}
