#include <bits/stdc++.h>
using namespace std;
long long POS(long long x) {
  if (x > 0)
    return x;
  else
    return 0;
}
struct ele {
  long double z, y, x;
  ele() {}
  ele(long double z, long double y, long double x) : z(z), y(y), x(x) {}
  ele operator+(const ele &p) const { return ele(z + p.z, y + p.y, x + p.x); }
  ele operator-(const ele &p) const { return ele(z - p.z, y - p.y, x - p.x); }
  ele operator*(long double con) const {
    return ele(z * con, y * con, x * con);
  }
  ele operator/(long double con) const {
    return ele(z / con, y / con, x / con);
  }
  bool operator<(const ele &rhs) const {
    return make_pair(z, make_pair(y, x)) <
           make_pair(rhs.z, make_pair(rhs.y, rhs.x));
  }
  bool operator==(const ele &rhs) const {
    return make_pair(z, make_pair(y, x)) ==
           make_pair(rhs.z, make_pair(rhs.y, rhs.x));
  }
};
typedef struct node {
  long long p, id;
  node() {}
  node(long long p, long long id) : p(p), id(id) {}
} node;
bool comp(node a, node b) { return a.p > b.p; }
int main() {
  long long n, k, b, sum = 0;
  cin >> n >> k;
  cin >> b;
  vector<node> v(n);
  vector<node>::iterator it;
  vector<long long> vi;
  for (long long i = (0); i < (n); ++i) {
    long long a;
    cin >> a;
    sum += a;
    v[i].p = a;
    v[i].id = i;
  }
  v[n - 1].p = 0;
  stable_sort(v.begin(), v.end(), comp);
  if (b >= sum) {
    cout << n << endl;
    return 0;
  } else {
    for (long long i = (0); i < (k - 1); ++i) {
      if (b < v[i].p) {
        break;
      }
      vi.push_back(v[i].id);
      b = b - v[i].p;
      v[i].p = -1;
    }
    bool flag = 0;
    for (long long i = (0); i < (n - 1); ++i) {
      if (v[i].p != -1 && v[i].p > b) {
        vi.push_back(v[i].id);
        flag = 1;
      }
    }
    if (flag != 1) {
      cout << n << endl;
      return 0;
    }
  }
  sort(vi.begin(), vi.end());
  cout << vi[0] + 1 << endl;
  return 0;
}
