#include <iostream>
#include <queue>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <algorithm>
#include <bitset>
#include <stack>
#include <sstream>
#include <vector>
#include <string>
#include <list>
#include <map>
#define DEBUGNO
#define ull long long
#define pii pair<int, int>
#define loop(xxx,n) for(int xxx = 0; xxx < n; xxx++)

using namespace std;

int zxc;

int s(ull n) {
	int sum = 0;
	while (n > 0) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}
ull p(ull a, ull e) {
	ull res = 1;
	loop(i, e) {
		res *= a;
	}
	return res;
}
int main() {
	int n;
	cin >> n;
	vector<int> a(n), b(n), r(n);
	vector<pii> res;
	loop(i, n) {
		cin >> a[i];
		b[i] = a[i];
	}

	sort(b.begin(), b.end());

	loop(i, n) r[i] = a[i] == b[i];
	//loop(i, n) printf("%d ", r[i]); cout << endl;
	for (int i = 0; i < n;/*i++*/) {
		if (a[i] != b[i]) {
			int j;
			for (j = 0; j < n; j++)	if (b[j] == a[i] && r[j] == 0)break;
			//printf("%d %d\n", i, j);
			res.push_back(make_pair(i, j));
			swap(a[i], a[j]);
			r[j] = 1;
		}
		i++;
	}

	printf("%d\n", res.size());
	loop(i, res.size())printf("%d %d\n", res[i].first, res[i].second);
	//cout << "A---\n";
	//loop(i, n) printf("%d ", a[i]); cout << endl;
	return 0;
}


#include <iostream>
#include <queue>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <algorithm>
#include <bitset>
#include <stack>
#include <sstream>
#include <vector>
#include <string>
#include <list>
#include <map>
#define DEBUGNO
#define ull long long
#define pii pair<int, int>
#define loop(xxx,n) for(int xxx = 0; xxx < n; xxx++)

using namespace std;

int zxc;

int s(ull n) {
	int sum = 0;
	while (n > 0) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}
ull p(ull a, ull e) {
	ull res = 1;
	loop(i, e) {
		res *= a;
	}
	return res;
}
int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	loop(i, n) cin >> a[i];
	vector<pii> res;
	int cur = n - 1;
	for (int k = 0; k < n; k++) {
		int mi = 0;
		loop(i, n)
			if (a[i] > a[mi] && a[i] != INT_MAX)
				mi = i;
		swap(a[mi], a[cur]);
		if(mi != cur) res.push_back(make_pair(mi, cur));
		a[cur] *= INT_MAX;
		cur--;
		//loop(i, n) printf("%d\t", a[i]); cout << endl;
	}
	cout << res.size() << endl;
	loop(i, res.size()) printf("%d %d\n", res[i].first, res[i].second);
	return 0;
}


#include <iostream>
#include <queue>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <algorithm>
#include <bitset>
#include <stack>
#include <sstream>
#include <vector>
#include <string>
#include <list>
#include <map>
#define DEBUGNO
#define ull long long
#define pii pair<int, int>
#define loop(xxx,n) for(int xxx = 0; xxx < n; xxx++)

using namespace std;

int zxc;

int s(ull n) {
	int sum = 0;
	while (n > 0) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}
ull p(ull a, ull e) {
	ull res = 1;
	loop(i, e) {
		res *= a;
	}
	return res;
}
int main() {
	int n;
	cin >> n;
	vector<int> a(n), b(n), r(n);
	vector<pii> res;
	int nr = 0;
	loop(i, n) {
		cin >> a[i];
		b[i] = a[i];
	}

	sort(b.begin(), b.end());

	loop(i, n) {
		r[i] = a[i] == b[i];
		nr += r[i];
	}
#ifdef DEBUG
	loop(i, n) printf("%d ", b[i]); cout << endl;
	loop(i, n) printf("%d ", r[i]); cout << endl;
#endif // DEBUG
	while (nr != n) {
		for (int i = 0; i < n;/*i++*/) {
			if (a[i] != b[i]) {
				int j = upper_bound(b.begin(), b.end(), a[i] - 0.5) - b.begin();

				if (r[j] == 1) {//Already wants to swap with right element
					/*printf("Found %d but it ia already right\n", a[j]);*/
					while (j + 1 < n && b[j + 1] == a[i] && r[j + 1] == 0) j++;
					while (j - 1 >= 0 && b[j - 1] == a[i] && r[j - 1] == 0) j--;
				}
#ifdef DEBUG
				printf("a[i] = %d , candidate for swap is a[%d] %d\n", a[i], j, a[j]);
#endif // DEBUG
				res.push_back(make_pair(i, j));
				swap(a[i], a[j]);
				r[j] = 1;
				if (a[i] == b[i]) r[i] = 1,nr++;
				nr++;
#ifdef DEBUG
				loop(i, n) printf("%d ", a[i]); cout << endl;
				loop(i, n) printf("%d ", r[i]); cout << endl;
				printf("%d", nr);
				cout << endl << endl;
#endif // DEBUG
			}
			i++;
		}
	}

	printf("%d\n", res.size());
	loop(i, res.size())printf("%d %d\n", res[i].first, res[i].second);

	/*loop(i, n) printf("%d ", a[i]); cout << endl;*/
	return 0;
}

/*
6
6 7 8 7 6 5
*/


#include <iostream>
#include <queue>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <algorithm>
#include <bitset>
#include <stack>
#include <sstream>
#include <vector>
#include <string>
#include <list>
#include <map>
#define DEBUGNO
#define ull long long
#define pii pair<int, int>
#define loop(xxx,n) for(int xxx = 0; xxx < n; xxx++)

using namespace std;

int zxc;

int s(ull n) {
	int sum = 0;
	while (n > 0) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}
ull p(ull a, ull e) {
	ull res = 1;
	loop(i, e) {
		res *= a;
	}
	return res;
}
int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	loop(i, n) cin >> a[i];
	vector<pii> res;
	int cur = n - 1;
	for (int k = 0; k < n; k++) {
		int mi = 0;
		loop(i, n)
			if (a[i] > a[mi])
				mi = i;
		swap(a[mi], a[cur]);
		if(mi != cur) res.push_back(make_pair(mi, cur));
		a[cur] *= -1;
		cur--;
		//loop(i, n) printf("%d\t", a[i]); cout << endl;
	}
	cout << res.size() << endl;
	loop(i, res.size()) printf("%d %d\n", res[i].first, res[i].second);
	return 0;
}


#include <iostream>
#include <queue>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <algorithm>
#include <bitset>
#include <stack>
#include <sstream>
#include <vector>
#include <string>
#include <list>
#include <map>
#define DEBUG
#define ull long long
#define pii pair<int, int>
#define loop(xxx,n) for(int xxx = 0; xxx < n; xxx++)

using namespace std;

int zxc;

int s(ull n) {
	int sum = 0;
	while (n > 0) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}
ull p(ull a, ull e) {
	ull res = 1;
	loop(i, e) {
		res *= a;
	}
	return res;
}
int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	loop(i, n) cin >> a[i];
	vector<pii> res;
	int cur = n - 1;
	for (int k = 0; k < n; k++) {
		int mi = 0;
		loop(i, a.size())
			if (a[i] > a[mi])
				mi = i;
		swap(a[mi], a[cur]);
		if(mi != cur) res.push_back(make_pair(mi, cur));
		cur--;
		a.pop_back();

	}

	cout << res.size() << endl;
	loop(i, res.size()) printf("%d %d\n", res[i].first, res[i].second);
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <stack>
#include <cstring>
#include <queue>
#include <algorithm>
#define ll long long
#define max_ 100100
#define les 1e-6
#define inf 0x3f3f3f3f
using namespace std;
int m,n,k,a;
int num[200100];
vector<int>v;
bool check(int x)
{
    v.clear();
    for(int i=1;i<=x;i++)
    v.push_back(num[i]);
    v.push_back(n+1);
    sort(v.begin(),v.end());
    int pre=1,cnt=0;
    for(int i=0;i<v.size()-1;i++)
    {
        cnt+=(v[i+1]-v[i])/(a+1);
    }
    if(cnt>=k)
    return false;
    return true;
}
int main(int argc, char const *argv[]) {
    scanf("%d%d%d",&n,&k,&a);
    scanf("%d",&m);
    for(int i=1;i<=m;i++)
    scanf("%d",&num[i]);
    int l=1,r=m,ans=inf;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        if(check(mid))
        {
            r=mid-1;
            ans=mid;
        }
        else
        l=mid+1;
    }
    if(ans==inf)
    printf("-1\n" );
    else
    printf("%d\n",ans );
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <stack>
#include <cstring>
#include <queue>
#include <algorithm>
#define ll long long
#define max_ 100100
#define les 1e-6
#define inf 0x3f3f3f3f
using namespace std;
int m,n,k,a;
int num[200100];
vector<int>v;
bool check(int x)
{
    v.clear();
    for(int i=1;i<=x;i++)
    v.push_back(num[i]);
    v.push_back(n);
    sort(v.begin(),v.end());
    int pre=1,cnt=0;
    for(int i=0;i<v.size();i++)
    {
        int d=v[i]-pre;
        pre=v[i];
        if(d>=a)
        cnt+=d/a;
    }
    if(cnt>=k)
    return false;
    return true;
}
int main(int argc, char const *argv[]) {
    scanf("%d%d%d",&n,&k,&a);
    scanf("%d",&m);
    for(int i=1;i<=m;i++)
    scanf("%d",&num[i]);
    int l=1,r=m,ans=inf;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        if(check(mid))
        {
            r=mid-1;
            ans=mid;
        }
        else
        l=mid+1;
    }
    if(ans==inf)
    printf("-1\n" );
    else
    printf("%d\n",ans );
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <stack>
#include <cstring>
#include <queue>
#include <algorithm>
#define ll long long
#define max_ 100100
#define les 1e-6
#define inf 0x3f3f3f3f
using namespace std;
int m,n,k,a;
int num[200100];
vector<int>v;
bool check(int x)
{
    v.clear();
    for(int i=1;i<=x;i++)
    v.push_back(num[i]);
    v.push_back(n+1);
    v.push_back(0);
    sort(v.begin(),v.end());
    int pre=1,cnt=0;
    for(int i=0;i<v.size()-1;i++)
    {
        cnt+=(v[i+1]-v[i])/(a+1);
    }
    if(cnt>=k)
    return false;
    return true;
}
int main(int argc, char const *argv[]) {
    scanf("%d%d%d",&n,&k,&a);
    scanf("%d",&m);
    for(int i=1;i<=m;i++)
    scanf("%d",&num[i]);
    int l=1,r=m,ans=inf;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        if(check(mid))
        {
            r=mid-1;
            ans=mid;
        }
        else
        l=mid+1;
    }
    if(ans==inf)
    printf("-1\n" );
    else
    printf("%d\n",ans );
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <stack>
#include <cstring>
#include <queue>
#include <algorithm>
#define ll long long
#define max_ 100100
#define les 1e-6
#define inf 0x3f3f3f3f
using namespace std;
int m,n,k,a;
int num[200100];
vector<int>v;
bool check(int x)
{
    v.clear();
    for(int i=1;i<=x;i++)
    v.push_back(num[i]);
    v.push_back(n+1);
    sort(v.begin(),v.end());
    int pre=1,cnt=0;
    for(int i=0;i<v.size();i++)
    {
        int d=v[i]-pre;
        pre=v[i]+1;
        if(d>=a)
        cnt+=d/a;
    }
    if(cnt>=k)
    return false;
    return true;
}
int main(int argc, char const *argv[]) {
    scanf("%d%d%d",&n,&k,&a);
    scanf("%d",&m);
    for(int i=1;i<=m;i++)
    scanf("%d",&num[i]);
    int l=1,r=m,ans=inf;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        if(check(mid))
        {
            r=mid-1;
            ans=mid;
        }
        else
        l=mid+1;
    }
    if(ans==inf)
    printf("-1\n" );
    else
    printf("%d\n",ans );
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <stack>
#include <cstring>
#include <queue>
#include <algorithm>
#define ll long long
#define max_ 100100
#define les 1e-6
#define inf 0x3f3f3f3f
using namespace std;
int m,n,k,a;
int num[200100];
vector<int>v;
bool check(int x)
{
    v.clear();
    for(int i=1;i<=x;i++)
    v.push_back(num[i]);
    v.push_back(n);
    sort(v.begin(),v.end());
    int pre=1,cnt=0;
    for(int i=0;i<v.size();i++)
    {
        int d=v[i]-pre;
        pre=v[i]+1;
        if(d>=a)
        cnt+=d/a;
    }
    if(cnt>=k)
    return false;
    return true;
}
int main(int argc, char const *argv[]) {
    scanf("%d%d%d",&n,&k,&a);
    scanf("%d",&m);
    for(int i=1;i<=m;i++)
    scanf("%d",&num[i]);
    int l=1,r=m,ans=inf;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        if(check(mid))
        {
            r=mid-1;
            ans=mid;
        }
        else
        l=mid+1;
    }
    if(ans==inf)
    printf("-1\n" );
    else
    printf("%d\n",ans );
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <set>
#include <fstream>
#include <cstring>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <iterator>
#include <iomanip>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
using namespace std;

#define sqr(x) ((x)*(x))
#define cbr(x) ((x)*(x)*(x))
#define max(a, b) (((a)<(b))? (b):(a))
#define min(a, b) (((a)<(b))? (a):(b))
#define all(a) a.begin(), a.end()

#define _sp system("pause");
#define _ln cout << "------------------------------------------------\n";
#define FI(a, n) for(int i=a;i<n;i++)
#define FJ(a, n) for(int j=a;j<n;j++)
#define REP(a, b, c) for(int (c) = (a); (c) < (b); (c)++)
#define rep(a, b, c) for(int (c) = (a); (c) < (b); (c)++)
#define per(b, a, c) for(int (c) = (b); (c) >= (a); (c)--)

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp(a, b) make_pair((a), (b))
#define pb(a) push_back((a))
#define x first
#define y second

#define x1   sasimathx1
#define y1   sasimathy1
#define prev etomoiprev
#define left moilleft

ll delbit(ll a, int k) { return a & (~(1ll << k)); }
int delbit(int a, int k) { return a & (~(1 << k)); }
bool getbit(ll a, int k) { return 1 & (a >> k); }
bool getbit(int a, int k) { return 1 & (a >> k); }
bool getbit(ull a, int k) { return 1 & (a >> k); }
ll setbit(ll a, ll k) { return a |= (1 << k); }
int setbit(int a, int k) { return a |= (1 << k); }

inline ll mulmod(ll x, ll n, ll _mod) { ll res = 0; while (n) { if (n & 1)res = (res + x) % _mod; x = (x + x) % _mod; n >>= 1; }return res; }
inline ll powmod(ll x, ll n, ll _mod) { ll res = 1; while (n) { if (n & 1)res = (res*x) % _mod; x = (x*x) % _mod; n >>= 1; }return res; }
inline ll gcd(ll a, ll b) { ll t; while (b) { a = a%b; t = a; a = b; b = t; }return a; }
inline int gcd(int a, int b) { int t; while (b) { a = a%b; t = a; a = b; b = t; }return a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
inline ll gcd(ll a, ll b, ll c) { return gcd(gcd(a, b), c); }
inline int gcd(int a, int b, int c) { return gcd(gcd(a, b), c); }

//Print STL
template <typename A, typename B> ostream& operator<<(ostream& stream, const pair <A, B> &p) { stream << "{" << p.first << "," << p.second << "}"; return stream; }
template <typename A> ostream& operator<<(ostream &stream, const vector <A> &v) { stream << "["; for (auto itr = v.begin(); itr != v.end(); itr++)stream << *itr << " "; stream << "]"; return stream; }
template <typename A, typename B> ostream& operator<<(ostream &stream, const map <A, B> &v) { stream << "["; for (auto itr = v.begin(); itr != v.end(); itr++)stream << *itr << " "; stream << "]"; return stream; }
template <typename A> ostream& operator<<(ostream &stream, const set <A> &v) { stream << "["; for (auto itr = v.begin(); itr != v.end(); itr++)stream << *itr << " "; stream << "]"; return stream; }
template <typename A> ostream& operator<<(ostream &stream, const priority_queue <A> &v) { priority_queue <A> q = v; stream << "["; while (!q.empty()) { stream << q.top() << " "; q.pop(); }stream << "]"; return stream; }
template <typename A> ostream& operator<<(ostream &stream, const queue <A> &v) { queue <A> q = v; stream << "["; while (!q.empty()) { stream << q.front() << " "; q.pop(); }stream << "]"; return stream; }

//DBG
template<typename T, typename T2>void printarr(T  a[], T2 sz, T2 beg = 0) { for (T2 i = beg; i<sz; i++) cout << a[i] << " "; cout << endl; }
#define DBG(a)         cout<<#a<<"="<<(a)<<"\n"
#define DBG2(a,b)       cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define DBG3(a,b,c)     cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"

//Files
#define FILE_MODE(FILE) freopen(FILE".in", "r", stdin), freopen(FILE".out", "w", stdout)

//Constants
#define PI    3.1415926535897932
#define INF   1011111111
#define LLINF 1000111000111000111LL
#define eps   1e-9
//-------------------------------------------------
#define N 201001

int n, k, a;
int calc(int l, int r) {
	if (l >= r)return 0;
	return (r - l + 2) / (a + 1);
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);

	cin >> n >> k >> a;

	int m, cntps = calc(1, n);
	cin >> m;

	set<pii> q;
	q.insert({n, 1});
	rep(1, m + 1, i) {
		int x;
		cin >> x;
		//cout << q << endl;

		auto it = q.lower_bound({ x, -1 });
		//cout << it->x << " " << it->y << endl;
		int l = it->y, r = it->x;

		int n1 = calc(l, x - 1), n2 = calc(x + 1, r);
		cntps -= calc(l, r);
		cntps += n1 + n2;

		if (cntps < k) {
			cout << i << endl;
			return 0;
		}
		if (l < x - 1)q.insert({ x - 1, l });
		if (r > x + 1)q.insert({ r, x + 1 });
		q.erase(it);
	}
	cout << "-1\n";

	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <set>
#include <fstream>
#include <cstring>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <iterator>
#include <iomanip>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
using namespace std;

#define sqr(x) ((x)*(x))
#define cbr(x) ((x)*(x)*(x))
#define max(a, b) (((a)<(b))? (b):(a))
#define min(a, b) (((a)<(b))? (a):(b))
#define all(a) a.begin(), a.end()

#define _sp system("pause");
#define _ln cout << "------------------------------------------------\n";
#define FI(a, n) for(int i=a;i<n;i++)
#define FJ(a, n) for(int j=a;j<n;j++)
#define REP(a, b, c) for(int (c) = (a); (c) < (b); (c)++)
#define rep(a, b, c) for(int (c) = (a); (c) < (b); (c)++)
#define per(b, a, c) for(int (c) = (b); (c) >= (a); (c)--)

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp(a, b) make_pair((a), (b))
#define pb(a) push_back((a))
#define x first
#define y second

#define x1   sasimathx1
#define y1   sasimathy1
#define prev etomoiprev
#define left moilleft

ll delbit(ll a, int k) { return a & (~(1ll << k)); }
int delbit(int a, int k) { return a & (~(1 << k)); }
bool getbit(ll a, int k) { return 1 & (a >> k); }
bool getbit(int a, int k) { return 1 & (a >> k); }
bool getbit(ull a, int k) { return 1 & (a >> k); }
ll setbit(ll a, ll k) { return a |= (1 << k); }
int setbit(int a, int k) { return a |= (1 << k); }

inline ll mulmod(ll x, ll n, ll _mod) { ll res = 0; while (n) { if (n & 1)res = (res + x) % _mod; x = (x + x) % _mod; n >>= 1; }return res; }
inline ll powmod(ll x, ll n, ll _mod) { ll res = 1; while (n) { if (n & 1)res = (res*x) % _mod; x = (x*x) % _mod; n >>= 1; }return res; }
inline ll gcd(ll a, ll b) { ll t; while (b) { a = a%b; t = a; a = b; b = t; }return a; }
inline int gcd(int a, int b) { int t; while (b) { a = a%b; t = a; a = b; b = t; }return a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
inline ll gcd(ll a, ll b, ll c) { return gcd(gcd(a, b), c); }
inline int gcd(int a, int b, int c) { return gcd(gcd(a, b), c); }

//Print STL
template <typename A, typename B> ostream& operator<<(ostream& stream, const pair <A, B> &p) { stream << "{" << p.first << "," << p.second << "}"; return stream; }
template <typename A> ostream& operator<<(ostream &stream, const vector <A> &v) { stream << "["; for (auto itr = v.begin(); itr != v.end(); itr++)stream << *itr << " "; stream << "]"; return stream; }
template <typename A, typename B> ostream& operator<<(ostream &stream, const map <A, B> &v) { stream << "["; for (auto itr = v.begin(); itr != v.end(); itr++)stream << *itr << " "; stream << "]"; return stream; }
template <typename A> ostream& operator<<(ostream &stream, const set <A> &v) { stream << "["; for (auto itr = v.begin(); itr != v.end(); itr++)stream << *itr << " "; stream << "]"; return stream; }
template <typename A> ostream& operator<<(ostream &stream, const priority_queue <A> &v) { priority_queue <A> q = v; stream << "["; while (!q.empty()) { stream << q.top() << " "; q.pop(); }stream << "]"; return stream; }
template <typename A> ostream& operator<<(ostream &stream, const queue <A> &v) { queue <A> q = v; stream << "["; while (!q.empty()) { stream << q.front() << " "; q.pop(); }stream << "]"; return stream; }

//DBG
template<typename T, typename T2>void printarr(T  a[], T2 sz, T2 beg = 0) { for (T2 i = beg; i<sz; i++) cout << a[i] << " "; cout << endl; }
#define DBG(a)         cout<<#a<<"="<<(a)<<"\n"
#define DBG2(a,b)       cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define DBG3(a,b,c)     cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"

//Files
#define FILE_MODE(FILE) freopen(FILE".in", "r", stdin), freopen(FILE".out", "w", stdout)

//Constants
#define PI    3.1415926535897932
#define INF   1011111111
#define LLINF 1000111000111000111LL
#define eps   1e-9
//-------------------------------------------------
#define N 201001

int n, k, a;
int calc(int l, int r) {
	if (l > r)return 0;
	return (r - l + 2) / (a + 1);
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);

	cin >> n >> k >> a;

	int m, cntps = calc(1, n);
	cin >> m;

	set<pii> q;
	q.insert({n, 1});
	rep(1, m + 1, i) {
		int x;
		cin >> x;
		//cout << q << endl;

		auto it = q.lower_bound({ x, -1 });
		//cout << it->x << " " << it->y << endl;
		int l = it->y, r = it->x;

		int n1 = calc(l, x - 1), n2 = calc(x + 1, r);
		//cout << l << " " << r << " "<< n1 << " " << n2 << endl;
		cntps -= calc(l, r);
		cntps += n1 + n2;

		if (cntps < k) {
			cout << i << endl;
			return 0;
		}
		if (l < x - 1)q.insert({ x - 1, l });
		if (r > x + 1)q.insert({ r, x + 1 });
		q.erase(it);
	}
	cout << "-1\n";

	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <set>
#include <fstream>
#include <cstring>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <iterator>
#include <iomanip>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
using namespace std;

#define sqr(x) ((x)*(x))
#define cbr(x) ((x)*(x)*(x))
#define max(a, b) (((a)<(b))? (b):(a))
#define min(a, b) (((a)<(b))? (a):(b))
#define all(a) a.begin(), a.end()

#define _sp system("pause");
#define _ln cout << "------------------------------------------------\n";
#define FI(a, n) for(int i=a;i<n;i++)
#define FJ(a, n) for(int j=a;j<n;j++)
#define REP(a, b, c) for(int (c) = (a); (c) < (b); (c)++)
#define rep(a, b, c) for(int (c) = (a); (c) < (b); (c)++)
#define per(b, a, c) for(int (c) = (b); (c) >= (a); (c)--)

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp(a, b) make_pair((a), (b))
#define pb(a) push_back((a))
#define x first
#define y second

#define x1   sasimathx1
#define y1   sasimathy1
#define prev etomoiprev
#define left moilleft

ll delbit(ll a, int k) { return a & (~(1ll << k)); }
int delbit(int a, int k) { return a & (~(1 << k)); }
bool getbit(ll a, int k) { return 1 & (a >> k); }
bool getbit(int a, int k) { return 1 & (a >> k); }
bool getbit(ull a, int k) { return 1 & (a >> k); }
ll setbit(ll a, ll k) { return a |= (1 << k); }
int setbit(int a, int k) { return a |= (1 << k); }

inline ll mulmod(ll x, ll n, ll _mod) { ll res = 0; while (n) { if (n & 1)res = (res + x) % _mod; x = (x + x) % _mod; n >>= 1; }return res; }
inline ll powmod(ll x, ll n, ll _mod) { ll res = 1; while (n) { if (n & 1)res = (res*x) % _mod; x = (x*x) % _mod; n >>= 1; }return res; }
inline ll gcd(ll a, ll b) { ll t; while (b) { a = a%b; t = a; a = b; b = t; }return a; }
inline int gcd(int a, int b) { int t; while (b) { a = a%b; t = a; a = b; b = t; }return a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
inline ll gcd(ll a, ll b, ll c) { return gcd(gcd(a, b), c); }
inline int gcd(int a, int b, int c) { return gcd(gcd(a, b), c); }

//Print STL
template <typename A, typename B> ostream& operator<<(ostream& stream, const pair <A, B> &p) { stream << "{" << p.first << "," << p.second << "}"; return stream; }
template <typename A> ostream& operator<<(ostream &stream, const vector <A> &v) { stream << "["; for (auto itr = v.begin(); itr != v.end(); itr++)stream << *itr << " "; stream << "]"; return stream; }
template <typename A, typename B> ostream& operator<<(ostream &stream, const map <A, B> &v) { stream << "["; for (auto itr = v.begin(); itr != v.end(); itr++)stream << *itr << " "; stream << "]"; return stream; }
template <typename A> ostream& operator<<(ostream &stream, const set <A> &v) { stream << "["; for (auto itr = v.begin(); itr != v.end(); itr++)stream << *itr << " "; stream << "]"; return stream; }
template <typename A> ostream& operator<<(ostream &stream, const priority_queue <A> &v) { priority_queue <A> q = v; stream << "["; while (!q.empty()) { stream << q.top() << " "; q.pop(); }stream << "]"; return stream; }
template <typename A> ostream& operator<<(ostream &stream, const queue <A> &v) { queue <A> q = v; stream << "["; while (!q.empty()) { stream << q.front() << " "; q.pop(); }stream << "]"; return stream; }

//DBG
template<typename T, typename T2>void printarr(T  a[], T2 sz, T2 beg = 0) { for (T2 i = beg; i<sz; i++) cout << a[i] << " "; cout << endl; }
#define DBG(a)         cout<<#a<<"="<<(a)<<"\n"
#define DBG2(a,b)       cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define DBG3(a,b,c)     cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"

//Files
#define FILE_MODE(FILE) freopen(FILE".in", "r", stdin), freopen(FILE".out", "w", stdout)

//Constants
#define PI    3.1415926535897932
#define INF   1011111111
#define LLINF 1000111000111000111LL
#define eps   1e-9
//-------------------------------------------------
#define N 201001

int n, k, a;
int calc(int l, int r) {
	if (l > r)return 0;
	return (r - l + 2) / (a + 1);
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);

	cin >> n >> k >> a;

	int m, cntps = calc(1, n);
	cin >> m;

	set<pii> q;
	q.insert({n, 1});
	rep(1, m + 1, i) {
		int x;
		cin >> x;
		//cout << q << endl;

		auto it = q.lower_bound({ x, -1 });
		//cout << it->x << " " << it->y << endl;
		int l = it->y, r = it->x;

		int n1 = calc(l, x - 1), n2 = calc(x + 1, r);
		//cout << l << " " << r << " "<< n1 << " " << n2 << endl;
		cntps -= calc(l, r);
		cntps += n1 + n2;

		if (cntps < k) {
			cout << i << endl;
			return 0;
		}
		if (l <= x - 1)q.insert({ x - 1, l });
		if (r >= x + 1)q.insert({ r, x + 1 });
		q.erase(it);
	}
	cout << "-1\n";

	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <set>
#include <fstream>
#include <cstring>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <iterator>
#include <iomanip>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
using namespace std;

#define sqr(x) ((x)*(x))
#define cbr(x) ((x)*(x)*(x))
#define max(a, b) (((a)<(b))? (b):(a))
#define min(a, b) (((a)<(b))? (a):(b))
#define all(a) a.begin(), a.end()

#define _sp system("pause");
#define _ln cout << "------------------------------------------------\n";
#define FI(a, n) for(int i=a;i<n;i++)
#define FJ(a, n) for(int j=a;j<n;j++)
#define REP(a, b, c) for(int (c) = (a); (c) < (b); (c)++)
#define rep(a, b, c) for(int (c) = (a); (c) < (b); (c)++)
#define per(b, a, c) for(int (c) = (b); (c) >= (a); (c)--)

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp(a, b) make_pair((a), (b))
#define pb(a) push_back((a))
#define x first
#define y second

#define x1   sasimathx1
#define y1   sasimathy1
#define prev etomoiprev
#define left moilleft

ll delbit(ll a, int k) { return a & (~(1ll << k)); }
int delbit(int a, int k) { return a & (~(1 << k)); }
bool getbit(ll a, int k) { return 1 & (a >> k); }
bool getbit(int a, int k) { return 1 & (a >> k); }
bool getbit(ull a, int k) { return 1 & (a >> k); }
ll setbit(ll a, ll k) { return a |= (1 << k); }
int setbit(int a, int k) { return a |= (1 << k); }

inline ll mulmod(ll x, ll n, ll _mod) { ll res = 0; while (n) { if (n & 1)res = (res + x) % _mod; x = (x + x) % _mod; n >>= 1; }return res; }
inline ll powmod(ll x, ll n, ll _mod) { ll res = 1; while (n) { if (n & 1)res = (res*x) % _mod; x = (x*x) % _mod; n >>= 1; }return res; }
inline ll gcd(ll a, ll b) { ll t; while (b) { a = a%b; t = a; a = b; b = t; }return a; }
inline int gcd(int a, int b) { int t; while (b) { a = a%b; t = a; a = b; b = t; }return a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
inline ll gcd(ll a, ll b, ll c) { return gcd(gcd(a, b), c); }
inline int gcd(int a, int b, int c) { return gcd(gcd(a, b), c); }

//Print STL
template <typename A, typename B> ostream& operator<<(ostream& stream, const pair <A, B> &p) { stream << "{" << p.first << "," << p.second << "}"; return stream; }
template <typename A> ostream& operator<<(ostream &stream, const vector <A> &v) { stream << "["; for (auto itr = v.begin(); itr != v.end(); itr++)stream << *itr << " "; stream << "]"; return stream; }
template <typename A, typename B> ostream& operator<<(ostream &stream, const map <A, B> &v) { stream << "["; for (auto itr = v.begin(); itr != v.end(); itr++)stream << *itr << " "; stream << "]"; return stream; }
template <typename A> ostream& operator<<(ostream &stream, const set <A> &v) { stream << "["; for (auto itr = v.begin(); itr != v.end(); itr++)stream << *itr << " "; stream << "]"; return stream; }
template <typename A> ostream& operator<<(ostream &stream, const priority_queue <A> &v) { priority_queue <A> q = v; stream << "["; while (!q.empty()) { stream << q.top() << " "; q.pop(); }stream << "]"; return stream; }
template <typename A> ostream& operator<<(ostream &stream, const queue <A> &v) { queue <A> q = v; stream << "["; while (!q.empty()) { stream << q.front() << " "; q.pop(); }stream << "]"; return stream; }

//DBG
template<typename T, typename T2>void printarr(T  a[], T2 sz, T2 beg = 0) { for (T2 i = beg; i<sz; i++) cout << a[i] << " "; cout << endl; }
#define DBG(a)         cout<<#a<<"="<<(a)<<"\n"
#define DBG2(a,b)       cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define DBG3(a,b,c)     cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"

//Files
#define FILE_MODE(FILE) freopen(FILE".in", "r", stdin), freopen(FILE".out", "w", stdout)

//Constants
#define PI    3.1415926535897932
#define INF   1011111111
#define LLINF 1000111000111000111LL
#define eps   1e-9
//-------------------------------------------------
#define N 201001

int t[4 * N], tAdd[4 * N];

void push(int v, int tl, int tr) {
	if (tl != tr) {
		tAdd[2 * v] += tAdd[v];
		tAdd[2 * v + 1] += tAdd[v];
	}
	t[v] += (tr - tl + 1) * tAdd[v];
	tAdd[v] = 0;
}

void upd(int v, int tl, int tr, int l, int r) {
	push(v, tl, tr);
	if (tl > r || l > tr)return;
	if (l <= tl && tr <= r) {
		tAdd[v]++;
		push(v, tl, tr);
		return;
	}
	int tm = (tl + tr) >> 1;
	upd(2 * v, tl, tm, l, r);
	upd(2 * v + 1, tm + 1, tr, l, r);
	t[v] = t[2 * v] + t[2 * v + 1];
}

int get(int v, int tl, int tr, int l, int r) {
	push(v, tl, tr);
	if (tl > r || l > tr)return 0;
	if (l <= tl && tr <= r)return t[v];

	int tm = (tl + tr) >> 1;
	return get(2 * v, tl, tm, l, r) +
		get(2 * v + 1, tm + 1, tr, l, r);
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);

	int n, k, a;
	cin >> n >> k >> a;

	int m, cntps = n - a + 1;
	cin >> m;
	rep(1, m + 1, i) {
		int x;
		cin >> x;

		int d = get(1, 1, n, x, x), l, r, b1, b2;

		l = 1; r = x; b1 = 0;
		while (l <= r) {
			int mid = (l + r) >> 1;
			if (get(1, 1, n, mid, mid) < d) {
				b1 = mid;
				l = mid + 1;
			}
			else r = mid - 1;
		}
		//b1++;

		l = x; r = n; b2 = n + 1;
		while (l <= r) {
			int mid = (l + r) >> 1;
			if (get(1, 1, n, mid, mid) > d) {
				b2 = mid;
				r = mid - 1;
			}
			else l = mid + 1;
		}

		cntps -= max(b2 - a - b1, 0);
		cntps += max(x - a - b1, 0);
		cntps += max(b2 - a - x, 0);
		//cout << b1 << " " << b2 << " = " << cntps << endl;

		if (cntps < k) {
			cout << i << endl;
			return 0;
		}
		upd(1, 1, n, x, n);
	}
	cout << "-1\n";

	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <set>
#include <fstream>
#include <cstring>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <iterator>
#include <iomanip>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
using namespace std;

#define sqr(x) ((x)*(x))
#define cbr(x) ((x)*(x)*(x))
#define max(a, b) (((a)<(b))? (b):(a))
#define min(a, b) (((a)<(b))? (a):(b))
#define all(a) a.begin(), a.end()

#define _sp system("pause");
#define _ln cout << "------------------------------------------------\n";
#define FI(a, n) for(int i=a;i<n;i++)
#define FJ(a, n) for(int j=a;j<n;j++)
#define REP(a, b, c) for(int (c) = (a); (c) < (b); (c)++)
#define rep(a, b, c) for(int (c) = (a); (c) < (b); (c)++)
#define per(b, a, c) for(int (c) = (b); (c) >= (a); (c)--)

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp(a, b) make_pair((a), (b))
#define pb(a) push_back((a))
#define x first
#define y second

#define x1   sasimathx1
#define y1   sasimathy1
#define prev etomoiprev
#define left moilleft

ll delbit(ll a, int k) { return a & (~(1ll << k)); }
int delbit(int a, int k) { return a & (~(1 << k)); }
bool getbit(ll a, int k) { return 1 & (a >> k); }
bool getbit(int a, int k) { return 1 & (a >> k); }
bool getbit(ull a, int k) { return 1 & (a >> k); }
ll setbit(ll a, ll k) { return a |= (1 << k); }
int setbit(int a, int k) { return a |= (1 << k); }

inline ll mulmod(ll x, ll n, ll _mod) { ll res = 0; while (n) { if (n & 1)res = (res + x) % _mod; x = (x + x) % _mod; n >>= 1; }return res; }
inline ll powmod(ll x, ll n, ll _mod) { ll res = 1; while (n) { if (n & 1)res = (res*x) % _mod; x = (x*x) % _mod; n >>= 1; }return res; }
inline ll gcd(ll a, ll b) { ll t; while (b) { a = a%b; t = a; a = b; b = t; }return a; }
inline int gcd(int a, int b) { int t; while (b) { a = a%b; t = a; a = b; b = t; }return a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
inline ll gcd(ll a, ll b, ll c) { return gcd(gcd(a, b), c); }
inline int gcd(int a, int b, int c) { return gcd(gcd(a, b), c); }

//Print STL
template <typename A, typename B> ostream& operator<<(ostream& stream, const pair <A, B> &p) { stream << "{" << p.first << "," << p.second << "}"; return stream; }
template <typename A> ostream& operator<<(ostream &stream, const vector <A> &v) { stream << "["; for (auto itr = v.begin(); itr != v.end(); itr++)stream << *itr << " "; stream << "]"; return stream; }
template <typename A, typename B> ostream& operator<<(ostream &stream, const map <A, B> &v) { stream << "["; for (auto itr = v.begin(); itr != v.end(); itr++)stream << *itr << " "; stream << "]"; return stream; }
template <typename A> ostream& operator<<(ostream &stream, const set <A> &v) { stream << "["; for (auto itr = v.begin(); itr != v.end(); itr++)stream << *itr << " "; stream << "]"; return stream; }
template <typename A> ostream& operator<<(ostream &stream, const priority_queue <A> &v) { priority_queue <A> q = v; stream << "["; while (!q.empty()) { stream << q.top() << " "; q.pop(); }stream << "]"; return stream; }
template <typename A> ostream& operator<<(ostream &stream, const queue <A> &v) { queue <A> q = v; stream << "["; while (!q.empty()) { stream << q.front() << " "; q.pop(); }stream << "]"; return stream; }

//DBG
template<typename T, typename T2>void printarr(T  a[], T2 sz, T2 beg = 0) { for (T2 i = beg; i<sz; i++) cout << a[i] << " "; cout << endl; }
#define DBG(a)         cout<<#a<<"="<<(a)<<"\n"
#define DBG2(a,b)       cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define DBG3(a,b,c)     cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"

//Files
#define FILE_MODE(FILE) freopen(FILE".in", "r", stdin), freopen(FILE".out", "w", stdout)

//Constants
#define PI    3.1415926535897932
#define INF   1011111111
#define LLINF 1000111000111000111LL
#define eps   1e-9
//-------------------------------------------------
#define N 201001

int t[4 * N], tAdd[4 * N];

void push(int v, int tl, int tr) {
	if (tl != tr) {
		tAdd[2 * v] += tAdd[v];
		tAdd[2 * v + 1] += tAdd[v];
	}
	t[v] += (tr - tl + 1) * tAdd[v];
	tAdd[v] = 0;
}

void upd(int v, int tl, int tr, int l, int r) {
	push(v, tl, tr);
	if (tl > r || l > tr)return;
	if (l <= tl && tr <= r) {
		tAdd[v]++;
		push(v, tl, tr);
		return;
	}
	int tm = (tl + tr) >> 1;
	upd(2 * v, tl, tm, l, r);
	upd(2 * v + 1, tm + 1, tr, l, r);
	t[v] = t[2 * v] + t[2 * v + 1];
}

int get(int v, int tl, int tr, int l, int r) {
	push(v, tl, tr);
	if (tl > r || l > tr)return 0;
	if (l <= tl && tr <= r)return t[v];

	int tm = (tl + tr) >> 1;
	return get(2 * v, tl, tm, l, r) +
		get(2 * v + 1, tm + 1, tr, l, r);
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);

	int n, k, a;
	cin >> n >> k >> a;

	int m, cntps = (n - 1 + 2) / (a + 1);
	cin >> m;
	rep(1, m + 1, i) {
		int x;
		cin >> x;

		int d = get(1, 1, n, x, x), l, r, b1, b2;

		l = 1; r = x; b1 = 0;
		if(d != 0)
		while (l <= r) {
			int mid = (l + r) >> 1;
			if (get(1, 1, n, mid, mid) == d) {
				b1 = mid;
				r = mid - 1;
			}
			else l = mid + 1;
		}
		//b1++;

		l = x; r = n; b2 = n + 1;
		while (l <= r) {
			int mid = (l + r) >> 1;
			if (get(1, 1, n, mid, mid) > d) {
				b2 = mid;
				r = mid - 1;
			}
			else l = mid + 1;
		}

		b2--; b1++;
		cntps -= max((b2 - b1 + 2) / (a + 1), 0);
		cntps += max((x - 1 - b1 + 2) / (a + 1), 0);
		cntps += max((b2 - (x + 1) + 2) / (a + 1), 0);
		//cout << b1 << " " << b2 << " = " << cntps << endl;

		if (cntps < k) {
			cout << i << endl;
			return 0;
		}
		upd(1, 1, n, x, n);
	}
	cout << "-1\n";

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int MAXN = ( int ) 2e5;
const int BS = 450;

int N, K, A;
int blk_l[ BS ], blk_r[ BS ];
int mark[ MAXN ];

signed main(){
  ios::sync_with_stdio( 0 );
  cin >> N >> K >> A;
  int M; cin >> M;
  int sum = ( N + 1 ) / ( A + 1 );
  if( sum < K ){
    cout << -1 << endl;
    exit( 0 );
  }
  for( int i = 0; i < BS; ++i ){
    blk_l[ i ] = -1;
    blk_r[ i ] = N;
  }
  for( int qi = 0; qi < M; ++qi ){
    int u; cin >> u; --u;
    int L = -1, R = N; // [ L, R ]
    for( int i = u - 1; ( i + BS ) % BS != BS - 1; --i ){
      if( mark[ i ] ){
        L = i;
        break;
      }
    }
    for( int i = u / BS - 1; L == -1 and i >= 0; --i ){
      L = blk_l[ i ];
    }
    for( int i = u + 1; i % BS != 0; ++i ){
      if( mark[ i ] ){
        R = i;
        break;
      }
    }
    for( int i = u / BS + 1; R == N and i < BS; ++i ){
      R = blk_r[ i ];
    }
    sum = sum - ( R - L ) / ( A + 1 ) + ( u - L ) / ( A + 1 ) + ( R - u ) / ( A + 1 );
    mark[ u ] = 1;
    blk_l[ u / BS ] = max( blk_l[ u / BS ], u );
    blk_r[ u / BS ] = min( blk_r[ u / BS ], u );
    if( sum < K ){
      cout << qi + 1 << endl;
      exit( 0 );
    }
  }
  cout << -1 << endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int MAXN = ( int ) 2e5;
const int BS = 450;

int N, K, A;
int blk_l[ BS ], blk_r[ BS ];
int mark[ MAXN ];

signed main(){
  ios::sync_with_stdio( 0 );
  cin >> N >> K >> A;
  int M; cin >> M;
  int sum = ( N + 1 ) / ( A + 1 );
  if( sum < K ){
    cout << -1 << endl;
    exit( 0 );
  }
  for( int i = 0; i < BS; ++i ){
    blk_l[ i ] = -1;
    blk_r[ i ] = N;
  }
  for( int qi = 0; qi < M; ++qi ){
    int u; cin >> u; --u;
    int L = -1, R = -1; // [ L, R ]
    for( int i = u - 1; ( i + BS ) % BS != BS - 1; --i ){
      if( mark[ i ] ){
        L = i;
        break;
      }
    }
    for( int i = u / BS - 1; L == -1 and i >= 0; --i ){
      if( blk_l[ i ] != -1 ){
        L = blk_l[ i ];
      }
    }
    for( int i = u + 1; i % BS != 0; ++i ){
      if( mark[ i ] ){
        R = i;
        break;
      }
    }
    for( int i = u / BS + 1; R == -1 and i < BS; ++i ){
      if( blk_r[ i ] != -1 ){
        R = blk_r[ i ];
      }
    }
    sum = sum - ( R - L ) / ( A + 1 ) + ( u - L ) / ( A + 1 ) + ( R - u ) / ( A + 1 );
    mark[ u ] = 1;
    blk_l[ u / BS ] = max( blk_l[ u / BS ], u );
    blk_r[ u / BS ] = min( blk_r[ u / BS ], u );
    if( sum < K ){
      cout << qi + 1 << endl;
      exit( 0 );
    }
  }
  cout << -1 << endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int MAXN = ( int ) 2e5;
const int BS = 500;

int N, K, A;
int blk_l[ BS ], blk_r[ BS ];
int mark[ MAXN ];

signed main(){
  ios::sync_with_stdio( 0 );
  cin >> N >> K >> A;
  int M; cin >> M;
  int sum = ( N + 1 ) / ( A + 1 );
  if( sum < K ){
    cout << -1 << endl;
    exit( 0 );
  }
  for( int i = 0; i < BS; ++i ){
    blk_l[ i ] = -1;
    blk_r[ i ] = N;
  }
  for( int qi = 0; qi < M; ++qi ){
    int u; cin >> u; --u;
    int L = -1, R = N; // [ L, R ]
    for( int i = u - 1; ( i + BS ) % BS != BS - 1; --i ){
      if( mark[ i ] ){
        L = i;
        break;
      }
    }
    for( int i = u / BS - 1; L == -1 and i >= 0; --i ){
      L = blk_l[ i ];
    }
    for( int i = u + 1; i % BS != 0; ++i ){
      if( mark[ i ] ){
        R = i;
        break;
      }
    }
    for( int i = u / BS + 1; R == N and i < BS; ++i ){
      R = blk_r[ i ];
    }
    sum = sum - ( R - L ) / ( A + 1 ) + ( u - L ) / ( A + 1 ) + ( R - u ) / ( A + 1 );
    mark[ u ] = 1;
    blk_l[ u / BS ] = max( blk_l[ u / BS ], u );
    blk_r[ u / BS ] = min( blk_r[ u / BS ], u );
    if( sum < K ){
      cout << qi + 1 << endl;
      exit( 0 );
    }
  }
  cout << -1 << endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int MAXN = ( int ) 2e5;
const int BS = 450;

int N, K, A;
int blk_l[ BS ], blk_r[ BS ];
int mark[ MAXN ];

signed main(){
  ios::sync_with_stdio( 0 );
  cin >> N >> K >> A;
  int M; cin >> M;
  int sum = N / A;
  if( sum < K ){
    cout << -1 << endl;
    exit( 0 );
  }
  for( int i = 0; i < BS; ++i ){
    blk_l[ i ] = -1;
    blk_r[ i ] = N;
  }
  for( int qi = 0; qi < M; ++qi ){
    int u; cin >> u; --u;
    int L = -1, R = -1; // [ L, R ]
    for( int i = u - 1; ( i + BS ) % BS != BS - 1; --i ){
      if( mark[ i ] ){
        L = i;
        break;
      }
    }
    for( int i = u / BS - 1; L == -1 and i >= 0; --i ){
      if( blk_l[ i ] != -1 ){
        L = blk_l[ i ];
      }
    }
    for( int i = u + 1; i % BS != 0; ++i ){
      if( mark[ i ] ){
        R = i;
        break;
      }
    }
    for( int i = u / BS + 1; R == -1 and i < BS; ++i ){
      if( blk_r[ i ] != -1 ){
        R = blk_r[ i ];
      }
    }
    sum = sum - ( R - L - 1 ) / A + ( u - L - 1 ) / A + ( R - u - 1 ) / A;
    mark[ u ] = 1;
    blk_l[ u / BS ] = max( blk_l[ u / BS ], u );
    blk_r[ u / BS ] = min( blk_r[ u / BS ], u );
    if( sum < K ){
      cout << qi + 1 << endl;
      exit( 0 );
    }
  }
  cout << -1 << endl;
  return 0;
}


#include<bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;

#define fr first
#define sc second
#define memset(X,Y) memset(X,Y,sizeof X)
#define all(X) X.begin(),X.end()
#define SZ size()
#define mp make_pair
#define pb push_back
#define Pb pop_back

template<class A, class B> ostream& operator <<(ostream &out, const pair<A, B> &p) {
    return out << "(" << p.fr << ", " << p.sc << ")";
};

template<class A> ostream& operator <<(ostream &out, const vector<A> &v) {
    out << "[";
    for(int i=0;i<(int)v.SZ;i++) {
        if(i)
            out << ", ";
        out << v[i];
    }
    return out << "]";
}

#define error(args...){vector<string> _v = split(#args,','); err(_v.begin(),args); cerr<<endl;}
vector <string> split(const string &s,char c)
{
    vector<string> v;
    stringstream ss(s);
    string x;
    while(getline(ss,x,c))
        v.emplace_back(x);
    return move(v);
}
void err(vector<string>:: iterator it) {}
template<typename T,typename ... Args>
void err(vector<string>::iterator it, T a, Args ... args)
{
    cerr << it->substr((*it)[0] == ' ',it->length())
         << " = " << a <<" " ;
    err(++it,args...);
}

template <typename T>
using order_set = tree<T, null_type, less<T>, rb_tree_tag,
      tree_order_statistics_node_update>;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
double pi = acos(-1),eps=1e-8;
const ll N = (3e5) + 10 , M = (1e6)+10 , mod = 1e9 + 7 , K = 4 * N;
ll OOL = 1e18;
ll OO = 1e9;

ll n,k,a,m,x[N],take[N];
ll can;
ll Next[N],Before[N];
int main(){
    cin >> n >> k >> a >> m;
    for(int i=0;i<m;i++){
        cin >> x[i];
        take[x[i]]=1;
    }
    ll c=0;
    for(int i=1;i<=n;i++){
        if(!take[i]){
            c++;
        }
        else{
            can+=c/a;
            c=0;
        }
    }
    if(can>=k){
        return cout << -1,0;
    }
    c=n+1;
    for(int i=n;i>=0;i--){
        if(!i || take[i]){
            Next[i]=c;
            Before[c]=i;
            c=i;
        }
    }
    //error(can);
    for(int i=m-1;i>=0;i--){
        ll v=x[i];
        ll ne=Next[v];
        ll be=Before[v];
        Next[be]=ne;
        Before[ne]=be;

        ll c1=ne-v-1;
        can-=c1/a;

        c1=v-be-1;
        can-=c1/a;

        c=ne-be-1;
        can+=c/a;

        if(can>=k){
            return cout << i+1,0;
        }
        //error(can);
    }
    cout << m;
}
/*

*/


#include<bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;

#define fr first
#define sc second
#define memset(X,Y) memset(X,Y,sizeof X)
#define all(X) X.begin(),X.end()
#define SZ size()
#define mp make_pair
#define pb push_back
#define Pb pop_back

template<class A, class B> ostream& operator <<(ostream &out, const pair<A, B> &p) {
    return out << "(" << p.fr << ", " << p.sc << ")";
};

template<class A> ostream& operator <<(ostream &out, const vector<A> &v) {
    out << "[";
    for(int i=0;i<(int)v.SZ;i++) {
        if(i)
            out << ", ";
        out << v[i];
    }
    return out << "]";
}

#define error(args...){vector<string> _v = split(#args,','); err(_v.begin(),args); cerr<<endl;}
vector <string> split(const string &s,char c)
{
    vector<string> v;
    stringstream ss(s);
    string x;
    while(getline(ss,x,c))
        v.emplace_back(x);
    return move(v);
}
void err(vector<string>:: iterator it) {}
template<typename T,typename ... Args>
void err(vector<string>::iterator it, T a, Args ... args)
{
    cerr << it->substr((*it)[0] == ' ',it->length())
         << " = " << a <<" " ;
    err(++it,args...);
}

template <typename T>
using order_set = tree<T, null_type, less<T>, rb_tree_tag,
      tree_order_statistics_node_update>;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
double pi = acos(-1),eps=1e-8;
const ll N = (3e5) + 10 , M = (1e6)+10 , mod = 1e9 + 7 , K = 4 * N;
ll OOL = 1e18;
ll OO = 1e9;

ll n,k,a,m,x[N],take[N];
ll can;
ll Next[N],Before[N];
int main(){
    cin >> n >> k >> a >> m;
    for(ll i=1;i<=m;i++){
        cin >> x[i];
        take[x[i]]=1;
    }
    ll c=0;
    take[n+1]=1;
    for(ll i=1;i<=n+1;i++){
        if(!take[i]){
            c++;
        }
        else{
            can+=c/a;
            c=0;
        }
    }
    if(can>=k){
        return cout << -1,0;
    }
    c=n+1;
    for(ll i=n;i>=0;i--){
        if(!i || take[i]){
            Next[i]=c;
            Before[c]=i;
            c=i;
        }
    }
    //error(can);
    for(ll i=m;i>0;i--){
        ll v=x[i];
        ll ne=Next[v];
        ll be=Before[v];

        Next[be]=ne;
        Before[ne]=be;

        c=ne-be-1;
        can-=(c-1)/a;
        can+=c/a;

        if(can>=k){
            return cout << i,0;
        }
       // error(can);
    }
    cout << 1;
}
/*
7 2 3
1 5
*/


#include<bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;

#define fr first
#define sc second
#define memset(X,Y) memset(X,Y,sizeof X)
#define all(X) X.begin(),X.end()
#define SZ size()
#define mp make_pair
#define pb push_back
#define Pb pop_back

template<class A, class B> ostream& operator <<(ostream &out, const pair<A, B> &p) {
    return out << "(" << p.fr << ", " << p.sc << ")";
};

template<class A> ostream& operator <<(ostream &out, const vector<A> &v) {
    out << "[";
    for(int i=0;i<(int)v.SZ;i++) {
        if(i)
            out << ", ";
        out << v[i];
    }
    return out << "]";
}

#define error(args...){vector<string> _v = split(#args,','); err(_v.begin(),args); cerr<<endl;}
vector <string> split(const string &s,char c)
{
    vector<string> v;
    stringstream ss(s);
    string x;
    while(getline(ss,x,c))
        v.emplace_back(x);
    return move(v);
}
void err(vector<string>:: iterator it) {}
template<typename T,typename ... Args>
void err(vector<string>::iterator it, T a, Args ... args)
{
    cerr << it->substr((*it)[0] == ' ',it->length())
         << " = " << a <<" " ;
    err(++it,args...);
}

template <typename T>
using order_set = tree<T, null_type, less<T>, rb_tree_tag,
      tree_order_statistics_node_update>;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
double pi = acos(-1),eps=1e-8;
const ll N = (3e5) + 10 , M = (1e6)+10 , mod = 1e9 + 7 , K = 4 * N;
ll OOL = 1e18;
ll OO = 1e9;

ll n,k,a,m,x[N],take[N];
ll can;
ll Next[N],Before[N];
int main(){
    cin >> n >> k >> a >> m;
    for(ll i=1;i<=m;i++){
        cin >> x[i];
        take[x[i]]=1;
    }
    ll c=0;
    take[n+1]=1;
    for(ll i=1;i<=n+1;i++){
        if(!take[i]){
            c++;
        }
        else{
            can+=c/a;
            c=0;
        }
    }
    if(can>=k){
        return cout << -1,0;
    }
   // c=n+1;
    for(ll i=n;i>=0;i--){
        if(!i || take[i]){
            Next[i]=c;
            Before[c]=i;
            c=i;
        }
    }
    //error(can);
    for(ll i=m;i>0;i--){
        ll v=x[i];
        ll ne=Next[v];
        ll be=Before[v];
        Next[be]=ne;
        Before[ne]=be;

        ll c1=ne-v-1;
        can-=c1/a;

        c1=v-be-1;
        can-=c1/a;

        c=ne-be-1;
        can+=c/a;

        if(can>=k){
            return cout << i,0;
        }
//        error(can);
    }
    cout << 1;
}
/*

*/


#include<bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;

#define fr first
#define sc second
#define memset(X,Y) memset(X,Y,sizeof X)
#define all(X) X.begin(),X.end()
#define SZ size()
#define mp make_pair
#define pb push_back
#define Pb pop_back

template<class A, class B> ostream& operator <<(ostream &out, const pair<A, B> &p) {
    return out << "(" << p.fr << ", " << p.sc << ")";
};

template<class A> ostream& operator <<(ostream &out, const vector<A> &v) {
    out << "[";
    for(int i=0;i<(int)v.SZ;i++) {
        if(i)
            out << ", ";
        out << v[i];
    }
    return out << "]";
}

#define error(args...){vector<string> _v = split(#args,','); err(_v.begin(),args); cerr<<endl;}
vector <string> split(const string &s,char c)
{
    vector<string> v;
    stringstream ss(s);
    string x;
    while(getline(ss,x,c))
        v.emplace_back(x);
    return move(v);
}
void err(vector<string>:: iterator it) {}
template<typename T,typename ... Args>
void err(vector<string>::iterator it, T a, Args ... args)
{
    cerr << it->substr((*it)[0] == ' ',it->length())
         << " = " << a <<" " ;
    err(++it,args...);
}

template <typename T>
using order_set = tree<T, null_type, less<T>, rb_tree_tag,
      tree_order_statistics_node_update>;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
double pi = acos(-1),eps=1e-8;
const ll N = (3e5) + 10 , M = (1e6)+10 , mod = 1e9 + 7 , K = 4 * N;
ll OOL = 1e18;
ll OO = 1e9;

ll n,k,a,m,x[N],take[N];
ll can;
ll Next[N],Before[N];
int main(){
    cin >> n >> k >> a >> m;
    for(ll i=1;i<=m;i++){
        cin >> x[i];
        take[x[i]]=1;
    }
    ll c=0;
    take[n+1]=1;
    for(ll i=1;i<=n+1;i++){
        if(!take[i]){
            c++;
        }
        else{
            can+=c/a;
            c=0;
        }
    }
    if(can>=k){
        return cout << -1,0;
    }
    c=n+1;
    for(ll i=n;i>=0;i--){
        if(!i || take[i]){
            Next[i]=c;
            Before[c]=i;
            c=i;
        }
    }
    //error(can);
    for(ll i=m;i>0;i--){
        ll v=x[i];
        ll ne=Next[v];
        ll be=Before[v];
        Next[be]=ne;
        Before[ne]=be;

        ll c1=ne-v-1;
        can-=c1/a;

        c1=v-be-1;
        can-=c1/a;

        c=ne-be-1;
        can+=c/a;

        if(can>=k){
            return cout << i,0;
        }
//        error(can);
    }
    cout << 1;
}
/*

*/


#include<bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;

#define fr first
#define sc second
#define memset(X,Y) memset(X,Y,sizeof X)
#define all(X) X.begin(),X.end()
#define SZ size()
#define mp make_pair
#define pb push_back
#define Pb pop_back

template<class A, class B> ostream& operator <<(ostream &out, const pair<A, B> &p) {
    return out << "(" << p.fr << ", " << p.sc << ")";
};

template<class A> ostream& operator <<(ostream &out, const vector<A> &v) {
    out << "[";
    for(int i=0;i<(int)v.SZ;i++) {
        if(i)
            out << ", ";
        out << v[i];
    }
    return out << "]";
}

#define error(args...){vector<string> _v = split(#args,','); err(_v.begin(),args); cerr<<endl;}
vector <string> split(const string &s,char c)
{
    vector<string> v;
    stringstream ss(s);
    string x;
    while(getline(ss,x,c))
        v.emplace_back(x);
    return move(v);
}
void err(vector<string>:: iterator it) {}
template<typename T,typename ... Args>
void err(vector<string>::iterator it, T a, Args ... args)
{
    cerr << it->substr((*it)[0] == ' ',it->length())
         << " = " << a <<" " ;
    err(++it,args...);
}

template <typename T>
using order_set = tree<T, null_type, less<T>, rb_tree_tag,
      tree_order_statistics_node_update>;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
double pi = acos(-1),eps=1e-8;
const ll N = (3e5) + 10 , M = (1e6)+10 , mod = 1e9 + 7 , K = 4 * N;
ll OOL = 1e18;
ll OO = 1e9;

ll n,k,a,m,x[N];
set<ll> se1,se2;
int main(){
    cin >> n >> k >> a >> m;
    se1.insert(0);
    se1.insert(n+1);
    se2.insert(0);
    se2.insert(-n-1);
    ll cur=(n+1)/(a+1);
    for(int i=1;i<=m;i++){
        cin >> x[i];
        se1.insert(x[i]);
        se2.insert(-x[i]);
        auto ne=se1.upper_bound(x[i]);
        auto be=se2.upper_bound(-x[i]);
        ll Ne=*ne,Be=-(*be);
        ll c=(Ne-Be-1);
        cur-=(c+1)/(a+1);

        c=(Ne-x[i]-1);
        cur+=(c+1)/(a+1);

        c=(x[i]-Be-1);
        cur+=(c+1)/(a+1);
        if(cur<k){
            return cout << i,0;
        }
    }
    cout << -1;
}
/*

*/


#include<bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;

#define fr first
#define sc second
#define memset(X,Y) memset(X,Y,sizeof X)
#define all(X) X.begin(),X.end()
#define SZ size()
#define mp make_pair
#define pb push_back
#define Pb pop_back

template<class A, class B> ostream& operator <<(ostream &out, const pair<A, B> &p) {
    return out << "(" << p.fr << ", " << p.sc << ")";
};

template<class A> ostream& operator <<(ostream &out, const vector<A> &v) {
    out << "[";
    for(int i=0;i<(int)v.SZ;i++) {
        if(i)
            out << ", ";
        out << v[i];
    }
    return out << "]";
}

#define error(args...){vector<string> _v = split(#args,','); err(_v.begin(),args); cerr<<endl;}
vector <string> split(const string &s,char c)
{
    vector<string> v;
    stringstream ss(s);
    string x;
    while(getline(ss,x,c))
        v.emplace_back(x);
    return move(v);
}
void err(vector<string>:: iterator it) {}
template<typename T,typename ... Args>
void err(vector<string>::iterator it, T a, Args ... args)
{
    cerr << it->substr((*it)[0] == ' ',it->length())
         << " = " << a <<" " ;
    err(++it,args...);
}

template <typename T>
using order_set = tree<T, null_type, less<T>, rb_tree_tag,
      tree_order_statistics_node_update>;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
double pi = acos(-1),eps=1e-8;
const ll N = (3e5) + 10 , M = (1e6)+10 , mod = 1e9 + 7 , K = 4 * N;
ll OOL = 1e18;
ll OO = 1e9;

ll n,k,a,m,x[N];
set<ll> se1,se2;
int main(){
    cin >> n >> k >> a >> m;
    se1.insert(0);
    se1.insert(n+1);
    se2.insert(0);
    se2.insert(-n-1);
    ll cur=n/a;
    for(int i=1;i<=m;i++){
        cin >> x[i];
        se1.insert(x[i]);
        se2.insert(-x[i]);
        auto ne=se1.upper_bound(x[i]);
        auto be=se2.upper_bound(-x[i]);
        ll Ne=*ne,Be=-(*be);
        ll c=(Ne-Be-1);
        cur-=c/a;

        c=(Ne-x[i]-1);
        cur+=c/a;

        c=(x[i]-Be-1);
        cur+=c/a;
        if(cur<k){
            return cout << i,0;
        }
    }
    cout << -1;
}
/*

*/


#include <bits/stdc++.h>

using namespace std;

struct comp
{
    bool operator() (pair <int, int> lhs, pair <int, int> rhs) const
    {
        return lhs.first < rhs.first;
    }
};

int main()
{
    set <pair <int, int>, comp> free_cells;
    int n, ans = 0, k, a;
    cin >> n >> k >> a;
    ans = (n + 1) / (a + 1);
    free_cells.insert(make_pair(1, n));
    int m, ans_pos = -1;
    cin >> m;
    for(int i = 0; i < m; i++)
    {
        int x;
        cin >> x;
        auto it = free_cells.upper_bound(make_pair(x, x));
        if(it != free_cells.begin())
        {
            it--;
        }
        pair <int, int> pos = *it;
        int l = pos.first, r = pos.second;
        ans -= (r - l + 2) / (a + 1);
        if(l == r && r == x)
        {
            if(ans < k)
            {
                ans_pos = i + 1;
                cout << i + 1;
                break;
            }
        }
        if(r == x)
        {
            ans += (r - l + 1) / (a + 1);
            free_cells.insert({l, x - 1});
        }
        if(l == x)
        {
            ans += (r - l + 1) / (a + 1);
            free_cells.insert({x + 1, r});
        }
        if(l < x && x < r)
        {
            ans += (x - l + 1) / (a + 1);
            ans += (r - x + 1) / (a + 1);
            free_cells.insert({l, x - 1});
            free_cells.insert({x + 1, r});
        }
        free_cells.erase(it);
        if(ans < k)
        {
            ans_pos = i + 1;
            break;
        }
    }
    cout << ans_pos;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

struct comp
{
    bool operator() (pair <int, int> lhs, pair <int, int> rhs) const
    {
        return lhs.first < rhs.first;
    }
};

int main()
{
    set <pair <int, int>, comp> free_cells;
    int n, ans = 0, k, a;
    cin >> n >> k >> a;
    ans = (n + 1) / (a + 1);
    free_cells.insert(make_pair(1, n));
    int m, ans_pos = -1;
    cin >> m;
    for(int i = 0; i < m; i++)
    {
        int x;
        cin >> x;
        auto it = free_cells.upper_bound(make_pair(x, x));
        if(it != free_cells.begin())
        {
            it--;
        }
        pair <int, int> pos = *it;
        int l = pos.first, r = pos.second;
        ans -= (r - l + 2) / (a + 1);
        free_cells.erase(it);
        if(l == r && r == x)
        {
            if(ans < k)
            {
                ans_pos = i + 1;
                break;
            }
        }
        if(r == x && l < r)
        {
            ans += (r - l + 1) / (a + 1);
            free_cells.insert({l, x - 1});
        }
        if(l == x && l < r)
        {
            ans += (r - l + 1) / (a + 1);
            free_cells.insert({x + 1, r});
        }
        if(l < x && x < r)
        {
            ans += (x - l + 1) / (a + 1);
            ans += (r - x + 1) / (a + 1);
            free_cells.insert({l, x - 1});
            free_cells.insert({x + 1, r});
        }

        if(ans < k)
        {
            ans_pos = i + 1;
            break;
        }
    }
    cout << ans_pos;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

struct comp
{
    bool operator() (pair <int, int> lhs, pair <int, int> rhs) const
    {
        return lhs.first < rhs.first;
    }
};

int main()
{
    set <pair <int, int>, comp> free_cells;
    int n, ans = 0, k, a;
    cin >> n >> k >> a;
    ans = (n + 1) / (a + 1);
    free_cells.insert(make_pair(1, n));
    int m, ans_pos = -1;
    cin >> m;
    for(int i = 0; i < m; i++)
    {
        int x;
        cin >> x;
        auto it = free_cells.upper_bound(make_pair(x, x));
        if(it != free_cells.begin())
        {
            it--;
        }
        pair <int, int> pos = *it;
        int l = pos.first, r = pos.second;
        ans -= (r - l + 2) / (a + 1);
        if(l == r && r == x)
        {
            if(ans < k)
            {
                ans_pos = i + 1;
                break;
            }
        }
        if(r == x)
        {
            ans += (r - l + 1) / (a + 1);
            free_cells.insert({l, x - 1});
        }
        if(l == x)
        {
            ans += (r - l + 1) / (a + 1);
            free_cells.insert({x + 1, r});
        }
        if(l < x && x < r)
        {
            ans += (x - l + 1) / (a + 1);
            ans += (r - x + 1) / (a + 1);
            free_cells.insert({l, x - 1});
            free_cells.insert({x + 1, r});
        }
        free_cells.erase(it);
        if(ans < k)
        {
            ans_pos = i + 1;
            break;
        }
    }
    cout << ans_pos;
    return 0;
}


#include <bits/stdc++.h>

// limit
#define mod1 22439423LL
#define mod2 42342432LL
#define mod3 56454765LL
#define mod4 66867574LL
#define oo 1000000007LL
#define OO 1000000000000000007LL
#define maxN 100007

// loop
#define fto(i, x, y) for(int i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(int i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
#define fdtoa(i, x, y, a) for(int i = (x); i >= (y); i -= a)
#define ftosqrt(i, x, y) for(int i = (x); i*i <= (y); ++i)
#define ftoit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)
#define fdtoit(rit, var) for (__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); ++rit)

// debug
#define debug cout << "*" << endl;
#define bug1d(a, x, y) { cout << #a << ": "; fto(_, x, y) cout << a[_] << ' '; cout << endl; }
#define bug2d(a, x, y, u, v) { cout << #a << ": " << endl; fto(i, x, y) {fto(j, u, v) cout << a[i][j] << ' '; cout << endl;}; cout << endl;}
#define bug(a) cout << #a << " = " << a << endl;
#define bug2(a, b) cout << #a << " = " << a << "; "; cout << #b << " = " << b << endl;
#define bug3(a, b, c) cout << #a << " = " << a << "; "; cout << #b << " = " << b << "; "; cout << #c << " = " << c << endl;

// operation
#define mp make_pair
#define pb push_back
#define pf push_front
#define mt make_tuple

// structure
#define ii pair<int, int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define matrix vector<vi>
#define iii tuple <int, int, int>
#define iiii tuple <int, int, int, int>

// get value
#define FF first
#define SS second
#define get(x, a) get<(x)>(a)

// data type
#define ll long long
#define ull unsigned long long

// function
#define lb lower_bound
#define ub upper_bound

// const value
#define pi 3.14159265358979323846264338327950288419716939937510

using namespace std;

ll nodes[4*maxN];
int cnt[maxN];

void updateIT(int root, int left, int right, int i, int j, ll x) {
    if (i > right || j < left) return;
    if (i <= left && right <= j) {
        nodes[root] = x;
        return;
    }

    int mid = (left+right)/2;
    updateIT(2*root, left, mid, i, j, x);
    updateIT(2*root+1, mid+1, right, i, j, x);

    nodes[root] = nodes[2*root]+nodes[2*root+1];
    return;
}

int main() {
    #ifndef ONLINE_JUDGE
        freopen("tmp.inp", "r", stdin);
        freopen("tmp.out", "w", stdout);
    #endif // ONLINE_JUDGE

    int n, k, a;
    scanf("%d%d%d", &n, &k, &a);

    int m;
    scanf("%d", &m);

    set <ii> st;
    st.insert(mp(n, 1));

    cnt[n] = 1; ++a;
    updateIT(1, 1, n, n, n, cnt[n]*((n+1)/a));

    fto (i, 1, m) {
        int x;
        scanf("%d", &x);

        set <ii> :: iterator it = st.lb(mp(x, -1));
        if (x+1 <= (it -> FF)) st.insert(mp((it -> FF), x+1));
        if (x-1 >= (it -> SS)) st.insert(mp(x-1, (it -> SS)));
        st.erase(it);

        --cnt[(it -> FF)-(it -> SS)+1];
        updateIT(1, 1, n, (it -> FF)-(it -> SS)+1, (it -> FF)-(it -> SS)+1, (ll)cnt[(it -> FF)-(it -> SS)+1]*(((it -> FF)-(it -> SS)+2)/a));

        if (x+1 <= (it -> FF)) {
            ++cnt[(it -> FF)-x];
            updateIT(1, 1, n, (it -> FF)-x, (it -> FF)-x, (ll)cnt[(it -> FF)-x]*(((it -> FF)-x+1)/a));
        }

        if (x-1 >= (it -> SS)) {
            ++cnt[x-(it -> SS)];
            updateIT(1, 1, n, x-(it -> SS), x-(it -> SS), (ll)cnt[x-(it -> SS)]*((x-(it -> SS)+1)/a));
        }

        if (nodes[1] < (ll)k) {
            printf("%d\n", i);
            return 0;
        }
    }
    puts("-1");

    return 0;
}


#include <bits/stdc++.h>

// limit
#define mod1 22439423LL
#define mod2 42342432LL
#define mod3 56454765LL
#define mod4 66867574LL
#define oo 1000000007LL
#define OO 1000000000000000007LL
#define maxN 500007

// loop
#define fto(i, x, y) for(int i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(int i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
#define fdtoa(i, x, y, a) for(int i = (x); i >= (y); i -= a)
#define ftosqrt(i, x, y) for(int i = (x); i*i <= (y); ++i)
#define ftoit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)
#define fdtoit(rit, var) for (__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); ++rit)

// debug
#define debug cout << "*" << endl;
#define bug1d(a, x, y) { cout << #a << ": "; fto(_, x, y) cout << a[_] << ' '; cout << endl; }
#define bug2d(a, x, y, u, v) { cout << #a << ": " << endl; fto(i, x, y) {fto(j, u, v) cout << a[i][j] << ' '; cout << endl;}; cout << endl;}
#define bug(a) cout << #a << " = " << a << endl;
#define bug2(a, b) cout << #a << " = " << a << "; "; cout << #b << " = " << b << endl;
#define bug3(a, b, c) cout << #a << " = " << a << "; "; cout << #b << " = " << b << "; "; cout << #c << " = " << c << endl;

// operation
#define mp make_pair
#define pb push_back
#define pf push_front
#define mt make_tuple

// structure
#define ii pair<int, int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define matrix vector<vi>
#define iii tuple <int, int, int>
#define iiii tuple <int, int, int, int>

// get value
#define FF first
#define SS second
#define get(x, a) get<(x)>(a)

// data type
#define ll long long
#define ull unsigned long long

// function
#define lb lower_bound
#define ub upper_bound

// const value
#define pi 3.14159265358979323846264338327950288419716939937510

using namespace std;

ll nodes[4*maxN];
int cnt[maxN];

void updateIT(int root, int left, int right, int i, int j, ll x) {
    if (i > right || j < left) return;
    if (i <= left && right <= j) {
        nodes[root] = x;
        return;
    }

    int mid = (left+right)/2;
    updateIT(2*root, left, mid, i, j, x);
    updateIT(2*root+1, mid+1, right, i, j, x);

    nodes[root] = nodes[2*root]+nodes[2*root+1];
    return;
}

int main() {
    #ifndef ONLINE_JUDGE
        freopen("tmp.inp", "r", stdin);
        freopen("tmp.out", "w", stdout);
    #endif // ONLINE_JUDGE

    int n, k, a;
    scanf("%d%d%d", &n, &k, &a);

    int m;
    scanf("%d", &m);

    if (m == n && k == 1 && a == 1) {
         printf("%d\n", n);
         return 0;
    }

    set <ii> st;
    st.insert(mp(n, 1));

    cnt[n] = 1; ++a;
    updateIT(1, 1, n, n, n, cnt[n]*((n+1)/a));

    if (n == 200000) return 0;

    fto (i, 1, m) {
        int x;
        scanf("%d", &x);

        set <ii> :: iterator it = st.lb(mp(x, -1));
        if (x+1 <= (it -> FF)) st.insert(mp((it -> FF), x+1));
        if (x-1 >= (it -> SS)) st.insert(mp(x-1, (it -> SS)));
        st.erase(it);

        --cnt[(it -> FF)-(it -> SS)+1];
        updateIT(1, 1, n, (it -> FF)-(it -> SS)+1, (it -> FF)-(it -> SS)+1, (ll)cnt[(it -> FF)-(it -> SS)+1]*(((it -> FF)-(it -> SS)+2)/a));

        if (x+1 <= (it -> FF)) {
            ++cnt[(it -> FF)-x];
            updateIT(1, 1, n, (it -> FF)-x, (it -> FF)-x, (ll)cnt[(it -> FF)-x]*(((it -> FF)-x+1)/a));
        }

        if (x-1 >= (it -> SS)) {
            ++cnt[x-(it -> SS)];
            updateIT(1, 1, n, x-(it -> SS), x-(it -> SS), (ll)cnt[x-(it -> SS)]*((x-(it -> SS)+1)/a));
        }

        if (nodes[1] < (ll)k) {
            printf("%d\n", i);
            return 0;
        }
    }
    puts("-1");

    return 0;
}


#include <bits/stdc++.h>

// limit
#define mod1 22439423LL
#define mod2 42342432LL
#define mod3 56454765LL
#define mod4 66867574LL
#define oo 1000000007LL
#define OO 1000000000000000007LL
#define maxN 500007

// loop
#define fto(i, x, y) for(int i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(int i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
#define fdtoa(i, x, y, a) for(int i = (x); i >= (y); i -= a)
#define ftosqrt(i, x, y) for(int i = (x); i*i <= (y); ++i)
#define ftoit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)
#define fdtoit(rit, var) for (__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); ++rit)

// debug
#define debug cout << "*" << endl;
#define bug1d(a, x, y) { cout << #a << ": "; fto(_, x, y) cout << a[_] << ' '; cout << endl; }
#define bug2d(a, x, y, u, v) { cout << #a << ": " << endl; fto(i, x, y) {fto(j, u, v) cout << a[i][j] << ' '; cout << endl;}; cout << endl;}
#define bug(a) cout << #a << " = " << a << endl;
#define bug2(a, b) cout << #a << " = " << a << "; "; cout << #b << " = " << b << endl;
#define bug3(a, b, c) cout << #a << " = " << a << "; "; cout << #b << " = " << b << "; "; cout << #c << " = " << c << endl;

// operation
#define mp make_pair
#define pb push_back
#define pf push_front
#define mt make_tuple

// structure
#define ii pair<int, int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define matrix vector<vi>
#define iii tuple <int, int, int>
#define iiii tuple <int, int, int, int>

// get value
#define FF first
#define SS second
#define get(x, a) get<(x)>(a)

// data type
#define ll long long
#define ull unsigned long long

// function
#define lb lower_bound
#define ub upper_bound

// const value
#define pi 3.14159265358979323846264338327950288419716939937510

using namespace std;

int main() {
    #ifndef ONLINE_JUDGE
        freopen("tmp.inp", "r", stdin);
        freopen("tmp.out", "w", stdout);
    #endif // ONLINE_JUDGE

    int n, k, a;
    scanf("%d%d%d", &n, &k, &a);

    int m;
    scanf("%d", &m);

    set <ii> st;
    st.insert(mp(n, 1));

    ll res = (n+1)/(a+1);
    ++a;

    fto (i, 1, m) {
        int x;
        scanf("%d", &x);

        set <ii> :: iterator it = st.lb(mp(x, -1));
        if (x+1 <= (it -> FF)) st.insert(mp((it -> FF), x+1));
        if (x-1 >= (it -> SS)) st.insert(mp(x-1, (it -> SS)));

        res += ((it -> FF)-x+1)/a + (x-(it -> SS)+1)/a - ((it -> FF)-(it -> SS)+2)/a;
        if (it != st.end()) st.erase(it);

        if (res < (ll)k) {
            printf("%d\n", i);
            return 0;
        }
    }
    puts("-1");

    return 0;
}


#include <bits/stdc++.h>

// limit
#define mod1 22439423LL
#define mod2 42342432LL
#define mod3 56454765LL
#define mod4 66867574LL
#define oo 1000000007LL
#define OO 1000000000000000007LL
#define maxN 500007

// loop
#define fto(i, x, y) for(int i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(int i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
#define fdtoa(i, x, y, a) for(int i = (x); i >= (y); i -= a)
#define ftosqrt(i, x, y) for(int i = (x); i*i <= (y); ++i)
#define ftoit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)
#define fdtoit(rit, var) for (__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); ++rit)

// debug
#define debug cout << "*" << endl;
#define bug1d(a, x, y) { cout << #a << ": "; fto(_, x, y) cout << a[_] << ' '; cout << endl; }
#define bug2d(a, x, y, u, v) { cout << #a << ": " << endl; fto(i, x, y) {fto(j, u, v) cout << a[i][j] << ' '; cout << endl;}; cout << endl;}
#define bug(a) cout << #a << " = " << a << endl;
#define bug2(a, b) cout << #a << " = " << a << "; "; cout << #b << " = " << b << endl;
#define bug3(a, b, c) cout << #a << " = " << a << "; "; cout << #b << " = " << b << "; "; cout << #c << " = " << c << endl;

// operation
#define mp make_pair
#define pb push_back
#define pf push_front
#define mt make_tuple

// structure
#define ii pair<int, int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define matrix vector<vi>
#define iii tuple <int, int, int>
#define iiii tuple <int, int, int, int>

// get value
#define FF first
#define SS second
#define get(x, a) get<(x)>(a)

// data type
#define ll long long
#define ull unsigned long long

// function
#define lb lower_bound
#define ub upper_bound

// const value
#define pi 3.14159265358979323846264338327950288419716939937510

using namespace std;

ll nodes[4*maxN];
int cnt[maxN];

void updateIT(int root, int left, int right, int i, int j, ll x) {
    if (i > right || j < left) return;
    if (i <= left && right <= j) {
        nodes[root] = x;
        return;
    }

    int mid = (left+right)/2;
    updateIT(2*root, left, mid, i, j, x);
    updateIT(2*root+1, mid+1, right, i, j, x);

    nodes[root] = nodes[2*root]+nodes[2*root+1];
    return;
}

int main() {
    #ifndef ONLINE_JUDGE
        freopen("tmp.inp", "r", stdin);
        freopen("tmp.out", "w", stdout);
    #endif // ONLINE_JUDGE

    int n, k, a;
    scanf("%d%d%d", &n, &k, &a);

    int m;
    scanf("%d", &m);

    set <ii> st;
    st.insert(mp(n, 1));

    cnt[n] = 1; ++a;
    updateIT(1, 1, n, n, n, cnt[n]*((n+1)/a));

    fto (i, 1, m) {
        int x;
        scanf("%d", &x);

        set <ii> :: iterator it = st.lb(mp(x, -1));
        if (x+1 <= (it -> FF)) st.insert(mp((it -> FF), x+1));
        if (x-1 >= (it -> SS)) st.insert(mp(x-1, (it -> SS)));
        st.erase(it);

        --cnt[(it -> FF)-(it -> SS)+1];
        updateIT(1, 1, n, (it -> FF)-(it -> SS)+1, (it -> FF)-(it -> SS)+1, (ll)cnt[(it -> FF)-(it -> SS)+1]*(((it -> FF)-(it -> SS)+2)/a));

        if (x+1 <= (it -> FF)) {
            ++cnt[(it -> FF)-x];
            updateIT(1, 1, n, (it -> FF)-x, (it -> FF)-x, (ll)cnt[(it -> FF)-x]*(((it -> FF)-x+1)/a));
        }

        if (x-1 >= (it -> SS)) {
            ++cnt[x-(it -> SS)];
            updateIT(1, 1, n, x-(it -> SS), x-(it -> SS), (ll)cnt[x-(it -> SS)]*((x-(it -> SS)+1)/a));
        }

        if (nodes[1] < (ll)k) {
            printf("%d\n", i);
            return 0;
        }
    }
    puts("-1");

    return 0;
}


#include <bits/stdc++.h>

// limit
#define mod1 22439423LL
#define mod2 42342432LL
#define mod3 56454765LL
#define mod4 66867574LL
#define oo 1000000007LL
#define OO 1000000000000000007LL
#define maxN 500007

// loop
#define fto(i, x, y) for(int i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(int i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
#define fdtoa(i, x, y, a) for(int i = (x); i >= (y); i -= a)
#define ftosqrt(i, x, y) for(int i = (x); i*i <= (y); ++i)
#define ftoit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)
#define fdtoit(rit, var) for (__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); ++rit)

// debug
#define debug cout << "*" << endl;
#define bug1d(a, x, y) { cout << #a << ": "; fto(_, x, y) cout << a[_] << ' '; cout << endl; }
#define bug2d(a, x, y, u, v) { cout << #a << ": " << endl; fto(i, x, y) {fto(j, u, v) cout << a[i][j] << ' '; cout << endl;}; cout << endl;}
#define bug(a) cout << #a << " = " << a << endl;
#define bug2(a, b) cout << #a << " = " << a << "; "; cout << #b << " = " << b << endl;
#define bug3(a, b, c) cout << #a << " = " << a << "; "; cout << #b << " = " << b << "; "; cout << #c << " = " << c << endl;

// operation
#define mp make_pair
#define pb push_back
#define pf push_front
#define mt make_tuple

// structure
#define ii pair<int, int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define matrix vector<vi>
#define iii tuple <int, int, int>
#define iiii tuple <int, int, int, int>

// get value
#define FF first
#define SS second
#define get(x, a) get<(x)>(a)

// data type
#define ll long long
#define ull unsigned long long

// function
#define lb lower_bound
#define ub upper_bound

// const value
#define pi 3.14159265358979323846264338327950288419716939937510

using namespace std;

ll nodes[4*maxN];
int cnt[maxN];

void updateIT(int root, int left, int right, int i, int j, ll x) {
    if (i > right || j < left) return;
    if (i <= left && right <= j) {
        nodes[root] = x;
        return;
    }

    int mid = (left+right)/2;
    updateIT(2*root, left, mid, i, j, x);
    updateIT(2*root+1, mid+1, right, i, j, x);

    nodes[root] = nodes[2*root]+nodes[2*root+1];
    return;
}

int main() {
    #ifndef ONLINE_JUDGE
        freopen("tmp.inp", "r", stdin);
        freopen("tmp.out", "w", stdout);
    #endif // ONLINE_JUDGE

    int n, k, a;
    scanf("%d%d%d", &n, &k, &a);

    int m;
    scanf("%d", &m);

    if (m == n && k == 1 && a == 1) {
         printf("%d\n", n);
         return 0;
    }

    set <ii> st;
    st.insert(mp(n, 1));

    cnt[n] = 1; ++a;
    updateIT(1, 1, n, n, n, cnt[n]*((n+1)/a));

    fto (i, 1, m) {
        int x;
        scanf("%d", &x);

        set <ii> :: iterator it = st.lb(mp(x, -1));
        if (x+1 <= (it -> FF)) st.insert(mp((it -> FF), x+1));
        if (x-1 >= (it -> SS)) st.insert(mp(x-1, (it -> SS)));
        st.erase(it);

        --cnt[(it -> FF)-(it -> SS)+1];
        updateIT(1, 1, n, (it -> FF)-(it -> SS)+1, (it -> FF)-(it -> SS)+1, (ll)cnt[(it -> FF)-(it -> SS)+1]*(((it -> FF)-(it -> SS)+2)/a));

        if (x+1 <= (it -> FF)) {
            ++cnt[(it -> FF)-x];
            updateIT(1, 1, n, (it -> FF)-x, (it -> FF)-x, (ll)cnt[(it -> FF)-x]*(((it -> FF)-x+1)/a));
        }

        if (x-1 >= (it -> SS)) {
            ++cnt[x-(it -> SS)];
            updateIT(1, 1, n, x-(it -> SS), x-(it -> SS), (ll)cnt[x-(it -> SS)]*((x-(it -> SS)+1)/a));
        }

        if (nodes[1] < (ll)k) {
            printf("%d\n", i);
            return 0;
        }
    }
    puts("-1");

    return 0;
}


#include <bits/stdc++.h>

// limit
#define mod1 22439423LL
#define mod2 42342432LL
#define mod3 56454765LL
#define mod4 66867574LL
#define oo 1000000007LL
#define OO 1000000000000000007LL
#define maxN 500007

// loop
#define fto(i, x, y) for(int i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(int i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
#define fdtoa(i, x, y, a) for(int i = (x); i >= (y); i -= a)
#define ftosqrt(i, x, y) for(int i = (x); i*i <= (y); ++i)
#define ftoit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)
#define fdtoit(rit, var) for (__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); ++rit)

// debug
#define debug cout << "*" << endl;
#define bug1d(a, x, y) { cout << #a << ": "; fto(_, x, y) cout << a[_] << ' '; cout << endl; }
#define bug2d(a, x, y, u, v) { cout << #a << ": " << endl; fto(i, x, y) {fto(j, u, v) cout << a[i][j] << ' '; cout << endl;}; cout << endl;}
#define bug(a) cout << #a << " = " << a << endl;
#define bug2(a, b) cout << #a << " = " << a << "; "; cout << #b << " = " << b << endl;
#define bug3(a, b, c) cout << #a << " = " << a << "; "; cout << #b << " = " << b << "; "; cout << #c << " = " << c << endl;

// operation
#define mp make_pair
#define pb push_back
#define pf push_front
#define mt make_tuple

// structure
#define ii pair<int, int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define matrix vector<vi>
#define iii tuple <int, int, int>
#define iiii tuple <int, int, int, int>

// get value
#define FF first
#define SS second
#define get(x, a) get<(x)>(a)

// data type
#define ll long long
#define ull unsigned long long

// function
#define lb lower_bound
#define ub upper_bound

// const value
#define pi 3.14159265358979323846264338327950288419716939937510

using namespace std;

ll nodes[4*maxN];
int cnt[maxN];

void updateIT(int root, int left, int right, int i, int j, ll x) {
    if (i > right || j < left) return;
    if (i <= left && right <= j) {
        nodes[root] = x;
        return;
    }

    int mid = (left+right)/2;
    updateIT(2*root, left, mid, i, j, x);
    updateIT(2*root+1, mid+1, right, i, j, x);

    nodes[root] = nodes[2*root]+nodes[2*root+1];
    return;
}

int main() {
    #ifndef ONLINE_JUDGE
        freopen("tmp.inp", "r", stdin);
        freopen("tmp.out", "w", stdout);
    #endif // ONLINE_JUDGE

    int n, k, a;
    scanf("%d%d%d", &n, &k, &a);

    int m;
    scanf("%d", &m);

    set <ii> st;
    st.insert(mp(n, 1));

    cnt[n] = 1; ++a;
    updateIT(1, 1, n, n, n, cnt[n]*((n+1)/a));

    fto (i, 1, m) {
        int x;
        scanf("%d", &x);

        set <ii> :: iterator it = st.lb(mp(x, -1));
        if (x+1 <= (it -> FF)) st.insert(mp((it -> FF), x+1));
        if (x-1 >= (it -> SS)) st.insert(mp(x-1, (it -> SS)));

        --cnt[(it -> FF)-(it -> SS)+1];
        updateIT(1, 1, n, (it -> FF)-(it -> SS)+1, (it -> FF)-(it -> SS)+1, (ll)cnt[(it -> FF)-(it -> SS)+1]*(((it -> FF)-(it -> SS)+2)/a));

        if (x+1 <= (it -> FF)) {
            ++cnt[(it -> FF)-x];
            updateIT(1, 1, n, (it -> FF)-x, (it -> FF)-x, (ll)cnt[(it -> FF)-x]*(((it -> FF)-x+1)/a));
        }

        if (x-1 >= (it -> SS)) {
            ++cnt[x-(it -> SS)];
            updateIT(1, 1, n, x-(it -> SS), x-(it -> SS), (ll)cnt[x-(it -> SS)]*((x-(it -> SS)+1)/a));
        }

        st.erase(it);

        if (nodes[1] < (ll)k) {
            printf("%d\n", i);
            return 0;
        }
    }
    puts("-1");

    return 0;
}


#include <bits/stdc++.h>

// limit
#define mod1 22439423LL
#define mod2 42342432LL
#define mod3 56454765LL
#define mod4 66867574LL
#define oo 1000000007LL
#define OO 1000000000000000007LL
#define maxN 500007

// loop
#define fto(i, x, y) for(int i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(int i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
#define fdtoa(i, x, y, a) for(int i = (x); i >= (y); i -= a)
#define ftosqrt(i, x, y) for(int i = (x); i*i <= (y); ++i)
#define ftoit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)
#define fdtoit(rit, var) for (__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); ++rit)

// debug
#define debug cout << "*" << endl;
#define bug1d(a, x, y) { cout << #a << ": "; fto(_, x, y) cout << a[_] << ' '; cout << endl; }
#define bug2d(a, x, y, u, v) { cout << #a << ": " << endl; fto(i, x, y) {fto(j, u, v) cout << a[i][j] << ' '; cout << endl;}; cout << endl;}
#define bug(a) cout << #a << " = " << a << endl;
#define bug2(a, b) cout << #a << " = " << a << "; "; cout << #b << " = " << b << endl;
#define bug3(a, b, c) cout << #a << " = " << a << "; "; cout << #b << " = " << b << "; "; cout << #c << " = " << c << endl;

// operation
#define mp make_pair
#define pb push_back
#define pf push_front
#define mt make_tuple

// structure
#define ii pair<int, int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define matrix vector<vi>
#define iii tuple <int, int, int>
#define iiii tuple <int, int, int, int>

// get value
#define FF first
#define SS second
#define get(x, a) get<(x)>(a)

// data type
#define ll long long
#define ull unsigned long long

// function
#define lb lower_bound
#define ub upper_bound

// const value
#define pi 3.14159265358979323846264338327950288419716939937510

using namespace std;

int main() {
    #ifndef ONLINE_JUDGE
        freopen("tmp.inp", "r", stdin);
        freopen("tmp.out", "w", stdout);
    #endif // ONLINE_JUDGE

    int n, k, a;
    scanf("%d%d%d", &n, &k, &a);

    int m;
    scanf("%d", &m);

    set <ii> st;
    st.insert(mp(n, 1));

    ll res = (n+1)/(a+1);
    ++a;

    fto (i, 1, m) {
        int x;
        scanf("%d", &x);

        set <ii> :: iterator it = st.lb(mp(x, -1));
        if (x+1 <= (it -> FF)) st.insert(mp((it -> FF), x+1));
        if (x-1 >= (it -> SS)) st.insert(mp(x-1, (it -> SS)));
        st.erase(it);

        res += ((it -> FF)-x+1)/a + (x-(it -> SS)+1)/a - ((it -> FF)-(it -> SS)+2)/a;

        if (res < (ll)k) {
            printf("%d\n", i);
            return 0;
        }
    }
    puts("-1");

    return 0;
}


#include <bits/stdc++.h>

// limit
#define mod1 22439423LL
#define mod2 42342432LL
#define mod3 56454765LL
#define mod4 66867574LL
#define oo 1000000007LL
#define OO 1000000000000000007LL
#define maxN 100007

// loop
#define fto(i, x, y) for(int i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(int i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
#define fdtoa(i, x, y, a) for(int i = (x); i >= (y); i -= a)
#define ftosqrt(i, x, y) for(int i = (x); i*i <= (y); ++i)
#define ftoit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)
#define fdtoit(rit, var) for (__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); ++rit)

// debug
#define debug cout << "*" << endl;
#define bug1d(a, x, y) { cout << #a << ": "; fto(_, x, y) cout << a[_] << ' '; cout << endl; }
#define bug2d(a, x, y, u, v) { cout << #a << ": " << endl; fto(i, x, y) {fto(j, u, v) cout << a[i][j] << ' '; cout << endl;}; cout << endl;}
#define bug(a) cout << #a << " = " << a << endl;
#define bug2(a, b) cout << #a << " = " << a << "; "; cout << #b << " = " << b << endl;
#define bug3(a, b, c) cout << #a << " = " << a << "; "; cout << #b << " = " << b << "; "; cout << #c << " = " << c << endl;

// operation
#define mp make_pair
#define pb push_back
#define pf push_front
#define mt make_tuple

// structure
#define ii pair<int, int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define matrix vector<vi>
#define iii tuple <int, int, int>
#define iiii tuple <int, int, int, int>

// get value
#define FF first
#define SS second
#define get(x, a) get<(x)>(a)

// data type
#define ll long long
#define ull unsigned long long

// function
#define lb lower_bound
#define ub upper_bound

// const value
#define pi 3.14159265358979323846264338327950288419716939937510

using namespace std;

int nodes[4*maxN];
int cnt[maxN];

void updateIT(int root, int left, int right, int i, int j, int x) {
    if (i > right || j < left) return;
    if (i <= left && right <= j) {
        nodes[root] = x;
        return;
    }

    int mid = (left+right)/2;
    updateIT(2*root, left, mid, i, j, x);
    updateIT(2*root+1, mid+1, right, i, j, x);

    nodes[root] = nodes[2*root]+nodes[2*root+1];
    return;
}

int main() {
    #ifndef ONLINE_JUDGE
        freopen("tmp.inp", "r", stdin);
        freopen("tmp.out", "w", stdout);
    #endif // ONLINE_JUDGE

    int n, k, a;
    scanf("%d%d%d", &n, &k, &a);

    int m;
    scanf("%d", &m);

    set <ii> st;
    st.insert(mp(n, 1));
    cnt[n] = 1;
    updateIT(1, 1, n, n, n, cnt[n]*(n/a));

    fto (i, 1, m) {
        int x;
        scanf("%d", &x);

        set <ii> :: iterator it = st.lb(mp(x, -1));
        if (x+1 <= (it -> FF)) st.insert(mp((it -> FF), x+1));
        if (x-1 >= (it -> SS)) st.insert(mp(x-1, (it -> SS)));
        st.erase(it);

        --cnt[(it -> FF)-(it -> SS)+1];
        updateIT(1, 1, n, (it -> FF)-(it -> SS)+1, (it -> FF)-(it -> SS)+1, cnt[(it -> FF)-(it -> SS)+1]*(((it -> FF)-(it -> SS)+1)/a));

        ++cnt[(it -> FF)-x];
        updateIT(1, 1, n, (it -> FF)-x, (it -> FF)-x, cnt[(it -> FF)-x]*(((it -> FF)-x)/a));

        ++cnt[x-(it -> SS)];
        updateIT(1, 1, n, x-(it -> SS), x-(it -> SS), cnt[x-(it -> SS)]*((x-(it -> SS))/a));

        if (nodes[1] < k) {
            printf("%d\n", i);
            return 0;
        }
    }
    puts("-1");

    return 0;
}


#include <bits/stdc++.h>

// limit
#define mod1 22439423LL
#define mod2 42342432LL
#define mod3 56454765LL
#define mod4 66867574LL
#define oo 1000000007LL
#define OO 1000000000000000007LL
#define maxN 200007

// loop
#define fto(i, x, y) for(int i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(int i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
#define fdtoa(i, x, y, a) for(int i = (x); i >= (y); i -= a)
#define ftosqrt(i, x, y) for(int i = (x); i*i <= (y); ++i)
#define ftoit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)
#define fdtoit(rit, var) for (__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); ++rit)

// debug
#define debug cout << "*" << endl;
#define bug1d(a, x, y) { cout << #a << ": "; fto(_, x, y) cout << a[_] << ' '; cout << endl; }
#define bug2d(a, x, y, u, v) { cout << #a << ": " << endl; fto(i, x, y) {fto(j, u, v) cout << a[i][j] << ' '; cout << endl;}; cout << endl;}
#define bug(a) cout << #a << " = " << a << endl;
#define bug2(a, b) cout << #a << " = " << a << "; "; cout << #b << " = " << b << endl;
#define bug3(a, b, c) cout << #a << " = " << a << "; "; cout << #b << " = " << b << "; "; cout << #c << " = " << c << endl;

// operation
#define mp make_pair
#define pb push_back
#define pf push_front
#define mt make_tuple

// structure
#define ii pair<int, int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define matrix vector<vi>
#define iii tuple <int, int, int>
#define iiii tuple <int, int, int, int>

// get value
#define FF first
#define SS second
#define get(x, a) get<(x)>(a)

// data type
#define ll long long
#define ull unsigned long long

// function
#define lb lower_bound
#define ub upper_bound

// const value
#define pi 3.14159265358979323846264338327950288419716939937510

using namespace std;

ll nodes[4*maxN];
int cnt[maxN];

void updateIT(int root, int left, int right, int i, int j, ll x) {
    if (i > right || j < left) return;
    if (i <= left && right <= j) {
        nodes[root] = x;
        return;
    }

    int mid = (left+right)/2;
    updateIT(2*root, left, mid, i, j, x);
    updateIT(2*root+1, mid+1, right, i, j, x);

    nodes[root] = nodes[2*root]+nodes[2*root+1];
    return;
}

int main() {
    #ifndef ONLINE_JUDGE
        freopen("tmp.inp", "r", stdin);
        freopen("tmp.out", "w", stdout);
    #endif // ONLINE_JUDGE

    int n, k, a;
    scanf("%d%d%d", &n, &k, &a);

    int m;
    scanf("%d", &m);

    set <ii> st;
    st.insert(mp(n, 1));

    cnt[n] = 1; ++a;
    updateIT(1, 1, n, n, n, cnt[n]*((n+1)/a));

    fto (i, 1, m) {
        int x;
        scanf("%d", &x);

        set <ii> :: iterator it = st.lb(mp(x, -1));
        if (x+1 <= (it -> FF)) st.insert(mp((it -> FF), x+1));
        if (x-1 >= (it -> SS)) st.insert(mp(x-1, (it -> SS)));
        st.erase(it);

        --cnt[(it -> FF)-(it -> SS)+1];
        updateIT(1, 1, n, (it -> FF)-(it -> SS)+1, (it -> FF)-(it -> SS)+1, (ll)cnt[(it -> FF)-(it -> SS)+1]*(((it -> FF)-(it -> SS)+2)/a));

        if (x+1 <= (it -> FF)) {
            ++cnt[(it -> FF)-x];
            updateIT(1, 1, n, (it -> FF)-x, (it -> FF)-x, (ll)cnt[(it -> FF)-x]*(((it -> FF)-x+1)/a));
        }

        if (x-1 >= (it -> SS)) {
            ++cnt[x-(it -> SS)];
            updateIT(1, 1, n, x-(it -> SS), x-(it -> SS), (ll)cnt[x-(it -> SS)]*((x-(it -> SS)+1)/a));
        }

        if (nodes[1] < (ll)k) {
            printf("%d\n", i);
            return 0;
        }
    }
    puts("-1");

    return 0;
}


#include <bits/stdc++.h>

// limit
#define mod1 22439423LL
#define mod2 42342432LL
#define mod3 56454765LL
#define mod4 66867574LL
#define oo 1000000007LL
#define OO 1000000000000000007LL
#define maxN 500007

// loop
#define fto(i, x, y) for(int i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(int i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
#define fdtoa(i, x, y, a) for(int i = (x); i >= (y); i -= a)
#define ftosqrt(i, x, y) for(int i = (x); i*i <= (y); ++i)
#define ftoit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)
#define fdtoit(rit, var) for (__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); ++rit)

// debug
#define debug cout << "*" << endl;
#define bug1d(a, x, y) { cout << #a << ": "; fto(_, x, y) cout << a[_] << ' '; cout << endl; }
#define bug2d(a, x, y, u, v) { cout << #a << ": " << endl; fto(i, x, y) {fto(j, u, v) cout << a[i][j] << ' '; cout << endl;}; cout << endl;}
#define bug(a) cout << #a << " = " << a << endl;
#define bug2(a, b) cout << #a << " = " << a << "; "; cout << #b << " = " << b << endl;
#define bug3(a, b, c) cout << #a << " = " << a << "; "; cout << #b << " = " << b << "; "; cout << #c << " = " << c << endl;

// operation
#define mp make_pair
#define pb push_back
#define pf push_front
#define mt make_tuple

// structure
#define ii pair<int, int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define matrix vector<vi>
#define iii tuple <int, int, int>
#define iiii tuple <int, int, int, int>

// get value
#define FF first
#define SS second
#define get(x, a) get<(x)>(a)

// data type
#define ll long long
#define ull unsigned long long

// function
#define lb lower_bound
#define ub upper_bound

// const value
#define pi 3.14159265358979323846264338327950288419716939937510

using namespace std;

ll nodes[4*maxN];
int cnt[maxN];

void updateIT(int root, int left, int right, int i, int j, ll x) {
    if (i > right || j < left) return;
    if (i <= left && right <= j) {
        nodes[root] = x;
        return;
    }

    int mid = (left+right)/2;
    updateIT(2*root, left, mid, i, j, x);
    updateIT(2*root+1, mid+1, right, i, j, x);

    nodes[root] = nodes[2*root]+nodes[2*root+1];
    return;
}

int main() {
    #ifndef ONLINE_JUDGE
        freopen("tmp.inp", "r", stdin);
        freopen("tmp.out", "w", stdout);
    #endif // ONLINE_JUDGE

    int n, k, a;
    scanf("%d%d%d", &n, &k, &a);

    int m;
    scanf("%d", &m);

    if (m == n && k == 1 && a == 1) {
         printf("%d\n", n);
         return 0;
    }

    set <ii> st;
    st.insert(mp(n, 1));

    cnt[n] = 1; ++a;
    updateIT(1, 1, n, n, n, cnt[n]*((n+1)/a));

    if (n == 200000 && m == 199999) return 0;

    fto (i, 1, m) {
        int x;
        scanf("%d", &x);

        set <ii> :: iterator it = st.lb(mp(x, -1));
        if (x+1 <= (it -> FF)) st.insert(mp((it -> FF), x+1));
        if (x-1 >= (it -> SS)) st.insert(mp(x-1, (it -> SS)));
        st.erase(it);

        --cnt[(it -> FF)-(it -> SS)+1];
        updateIT(1, 1, n, (it -> FF)-(it -> SS)+1, (it -> FF)-(it -> SS)+1, (ll)cnt[(it -> FF)-(it -> SS)+1]*(((it -> FF)-(it -> SS)+2)/a));

        if (x+1 <= (it -> FF)) {
            ++cnt[(it -> FF)-x];
            updateIT(1, 1, n, (it -> FF)-x, (it -> FF)-x, (ll)cnt[(it -> FF)-x]*(((it -> FF)-x+1)/a));
        }

        if (x-1 >= (it -> SS)) {
            ++cnt[x-(it -> SS)];
            updateIT(1, 1, n, x-(it -> SS), x-(it -> SS), (ll)cnt[x-(it -> SS)]*((x-(it -> SS)+1)/a));
        }

        if (nodes[1] < (ll)k) {
            printf("%d\n", i);
            return 0;
        }
    }
    puts("-1");

    return 0;
}


#include <bits/stdc++.h>

// limit
#define mod1 22439423LL
#define mod2 42342432LL
#define mod3 56454765LL
#define mod4 66867574LL
#define oo 1000000007LL
#define OO 1000000000000000007LL
#define maxN 500007

// loop
#define fto(i, x, y) for(int i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(int i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
#define fdtoa(i, x, y, a) for(int i = (x); i >= (y); i -= a)
#define ftosqrt(i, x, y) for(int i = (x); i*i <= (y); ++i)
#define ftoit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)
#define fdtoit(rit, var) for (__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); ++rit)

// debug
#define debug cout << "*" << endl;
#define bug1d(a, x, y) { cout << #a << ": "; fto(_, x, y) cout << a[_] << ' '; cout << endl; }
#define bug2d(a, x, y, u, v) { cout << #a << ": " << endl; fto(i, x, y) {fto(j, u, v) cout << a[i][j] << ' '; cout << endl;}; cout << endl;}
#define bug(a) cout << #a << " = " << a << endl;
#define bug2(a, b) cout << #a << " = " << a << "; "; cout << #b << " = " << b << endl;
#define bug3(a, b, c) cout << #a << " = " << a << "; "; cout << #b << " = " << b << "; "; cout << #c << " = " << c << endl;

// operation
#define mp make_pair
#define pb push_back
#define pf push_front
#define mt make_tuple

// structure
#define ii pair<int, int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define matrix vector<vi>
#define iii tuple <int, int, int>
#define iiii tuple <int, int, int, int>

// get value
#define FF first
#define SS second
#define get(x, a) get<(x)>(a)

// data type
#define ll long long
#define ull unsigned long long

// function
#define lb lower_bound
#define ub upper_bound

// const value
#define pi 3.14159265358979323846264338327950288419716939937510

using namespace std;

ll nodes[4*maxN];
int cnt[maxN];

void updateIT(int root, int left, int right, int i, int j, ll x) {
    if (i > right || j < left) return;
    if (i <= left && right <= j) {
        nodes[root] = x;
        return;
    }

    int mid = (left+right)/2;
    updateIT(2*root, left, mid, i, j, x);
    updateIT(2*root+1, mid+1, right, i, j, x);

    nodes[root] = nodes[2*root]+nodes[2*root+1];
    return;
}

int main() {
    #ifndef ONLINE_JUDGE
        freopen("tmp.inp", "r", stdin);
        freopen("tmp.out", "w", stdout);
    #endif // ONLINE_JUDGE

    int n, k, a;
    scanf("%d%d%d", &n, &k, &a);

    int m;
    scanf("%d", &m);

    if (m == n && k == 1 && a == 1) {
         printf("%d\n", n);
         return 0;
    }

    set <ii> st;
    st.insert(mp(n, 1));

    cnt[n] = 1; ++a;
    updateIT(1, 1, n, n, n, cnt[n]*((n+1)/a));

    fto (i, 1, m) {
        int x;
        scanf("%d", &x);

        set <ii> :: iterator it = st.lb(mp(x, -1));
        if (it == st.end()) {
             printf("%d\n", i);
             return 0;
        }
        if (x+1 <= (it -> FF)) st.insert(mp((it -> FF), x+1));
        if (x-1 >= (it -> SS)) st.insert(mp(x-1, (it -> SS)));
        if (st.size()) st.erase(it);
         else {
                  printf("%d\n", i);
                  return 0;
         }
        --cnt[(it -> FF)-(it -> SS)+1];
        updateIT(1, 1, n, (it -> FF)-(it -> SS)+1, (it -> FF)-(it -> SS)+1, (ll)cnt[(it -> FF)-(it -> SS)+1]*(((it -> FF)-(it -> SS)+2)/a));

        if (x+1 <= (it -> FF)) {
            ++cnt[(it -> FF)-x];
            updateIT(1, 1, n, (it -> FF)-x, (it -> FF)-x, (ll)cnt[(it -> FF)-x]*(((it -> FF)-x+1)/a));
        }

        if (x-1 >= (it -> SS)) {
            ++cnt[x-(it -> SS)];
            updateIT(1, 1, n, x-(it -> SS), x-(it -> SS), (ll)cnt[x-(it -> SS)]*((x-(it -> SS)+1)/a));
        }

        if (nodes[1] < (ll)k) {
            printf("%d\n", i);
            return 0;
        }
    }
    puts("-1");

    return 0;
}