#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (b < a) {
    long long int temp = a;
    a = b;
    b = temp;
  }
  if (a == 0) {
    return b;
  }
  return gcd(b % a, a);
}
long long int lcm(long long int a, long long int b) {
  return (a * b / gcd(a, b));
}
long long int fact(long long int x) {
  long long int ans = 1;
  if (x == 0) {
    return 1;
  }
  while (x > 0) {
    ans = (ans * x) % 1000000007;
    x--;
  }
  return ans % 1000000007;
}
long long int power(long long int a, long long int b) {
  long long int ans = 1;
  while (b > 0) {
    if (b % 2 == 1) {
      ans *= a;
      ans = ans;
    }
    b /= 2;
    a *= a;
    a = a;
  }
  return ans;
}
vector<long long int> getbinary(long long int x) {
  vector<long long int> bin(20000, 0);
  long long int iter = 0;
  while (x > 0) {
    if (x % 2 == 1) {
      bin[iter] = 1;
    } else {
      bin[iter] = 0;
    }
    iter++;
    x /= 2;
  }
  return bin;
}
using namespace std;
int main() {
  long long int n, k, b, i, x;
  cin >> n >> k >> b;
  pair<long long int, long long int> a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i + 1;
  }
  sort(a, a + n);
  for (i = 0; i < n; i++) {
    x = i + 1;
    while (x < n && a[x].first == a[i].first) {
      x++;
    }
    if (x != i + 1) reverse(a + i, a + x);
    i = x - 1;
  }
  x = n;
  for (i = n - 1; i >= 0; i--) {
    if (a[i].second == n) {
      continue;
    } else {
      if (k == 1) {
        long long int j = i;
        while (j >= 0) {
          if (a[j].first > b && a[j].second < x) {
            x = a[j].second;
          }
          j--;
        }
      }
      k--;
      b -= a[i].first;
      if (a[i].second < x) x = a[i].second;
      if (k > 0 && b <= 0) {
        cout << 1;
        return 0;
      }
      if (k == 0 && b >= 0) {
        cout << n;
        return 0;
      }
      if (k == 0) {
        break;
      }
    }
  }
  cout << x;
}
