#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const double pi = 3.14159265358979323846264338327950288419716939937511;
const double eps = 1e-12;
char ch_ch_ch[1 << 20];
string gs() {
  scanf("%s", ch_ch_ch);
  return string(ch_ch_ch);
}
string gl() {
  gets(ch_ch_ch);
  return string(ch_ch_ch);
}
inline int gi() {
  int x;
  scanf("%d", &x);
  return x;
}
vector<pair<int, int> > v;
int n, k;
long long money;
vector<int> was;
vector<int> a;
void solution() {
  scanf("%d%d", &n, &k);
  cin >> money;
  for (int i = 0; i < (n); ++i) {
    int x;
    x = gi();
    a.push_back(x);
    if (i != n - 1) v.push_back(make_pair(x, i));
  }
  sort(v.rbegin(), v.rend());
  was.resize(v.size(), 0);
  long long sum = 0, sumk = 0;
  for (int i = 0; i < (k - 1); ++i) {
    was[v[i].second] = 1;
    sum += v[i].first;
  }
  sumk = sum + v[k - 1].first;
  int res = n - 1;
  for (int i = 0; i < (n - 1); ++i)
    if (was[i]) {
      if (sumk > money) {
        res = i;
        break;
      }
    } else if (sum + a[i] > money) {
      res = i;
      break;
    }
  cout << res + 1 << endl;
}
int main(int argc, char** argv) {
  solution();
  return 0;
}
