#include <bits/stdc++.h>
const double eps = 1e-10;
const int INF = (1 << 30);
const int maxn = 100010;
using namespace std;
long long a[maxn], c[maxn];
int main() {
  int n, k, i, j, t;
  long long b, v;
  while (cin >> n >> k) {
    cin >> b;
    v = 0;
    for (i = 1; i <= n; ++i) {
      cin >> a[i];
      c[i] = a[i];
    }
    sort(c + 1, c + n);
    i = n - 1;
    while (b - c[i] >= 0 && k > 1) {
      b -= c[i];
      k--;
      i--;
    }
    if (b >= c[i])
      cout << n << endl;
    else {
      for (i = 1; i < n; ++i)
        if (a[i] > b) break;
      cout << i << endl;
    }
  }
  return 0;
}
