#include <bits/stdc++.h>
using namespace std;
template <class T>
int popcount(T n);
template <>
int popcount(unsigned int n) {
  return n ? __builtin_popcount(n) : 0;
}
template <>
int popcount(int n) {
  return n ? __builtin_popcount(n) : 0;
}
template <>
int popcount(unsigned long long n) {
  return n ? __builtin_popcountll(n) : 0;
}
template <>
int popcount(long long n) {
  return n ? __builtin_popcountll(n) : 0;
}
template <class T>
void max_swap(T& a, const T& b) {
  a = max(a, b);
}
template <class T>
void min_swap(T& a, const T& b) {
  a = min(a, b);
}
const double EPS = 1e-8;
const double PI = acos(-1.0);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
bool valid_pos(int x, int y, int w, int h) {
  return 0 <= x && x < w && 0 <= y && y < h;
}
template <class T>
void print(T a, int n, int br = 1, const string& deli = ", ") {
  cout << "{ ";
  for (int i = 0; i < n; ++i) {
    cout << a[i];
    if (i + 1 != n) cout << deli;
  }
  cout << " }";
  while (br--) cout << endl;
}
template <class T>
void print(const vector<T>& v, int br = 1, const string& deli = ", ") {
  print(v, v.size(), br, deli);
}
int main() {
  ios::sync_with_stdio(false);
  int n, k;
  long long b;
  cin >> n >> k >> b;
  static long long a[114514];
  static pair<long long, int> t[114514];
  for (int i = 0; i < n; ++i) cin >> a[i], t[i] = pair<long long, int>(a[i], i);
  a[n - 1] = t[n - 1].first = 0;
  sort(t, t + n, greater<pair<long long, int> >());
  long long sum = 0;
  static bool in_sum[114514];
  for (int i = 0; i < k; ++i) sum += t[i].first, in_sum[t[i].second] = true;
  long long res = n;
  for (int i = 0; i < n && res == n; ++i) {
    if (in_sum[i]) {
      if (sum > b) res = i + 1;
    } else {
      if (sum - t[k - 1].first + a[i] > b) res = i + 1;
    }
  }
  cout << res << endl;
}
