#include <bits/stdc++.h>
using namespace std;
ifstream fin("input.txt");
ofstream fout("output.txt");
long long n, k, bug;
int A[100010];
pair<int, int> cost[100010];
int vis[100010];
int main() {
  cin >> n >> k >> bug;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
    cost[i].first = A[i];
    cost[i].second = i;
  }
  A[n - 1] = 0;
  cost[n - 1].first = 0;
  sort(cost, cost + n, greater<pair<int, int> >());
  long long sum = 0;
  for (int i = 0; i < k - 1; i++) {
    sum += cost[i].first;
    vis[cost[i].second] = 1;
  }
  for (int i = 0; i < n; i++) {
    if (!vis[i]) {
      if (sum + A[i] > bug) {
        cout << i + 1;
        return 0;
      }
    } else {
      if (sum + cost[k - 1].first > bug) {
        cout << i + 1;
        return 0;
      }
    }
  }
  cout << n;
  return 0;
}
