#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
long long a[maxn];
struct p {
  long long tim;
  long long cost;
} b[maxn];
bool cmp(p a, p b) { return a.cost < b.cost; }
int main() {
  long long s, d, t;
  int n;
  cin >> s >> d >> t >> n;
  int i, j, sum = 0;
  long long pre = 0;
  for (i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
    if (a[i] <= s) {
      pre += a[i];
      sum++;
    }
  }
  long long tim = 0;
  int top = 0;
  if (n == 0) {
    if (d - s + 1 >= t)
      printf("%lld\n", s);
    else
      printf("-1");
    return 0;
  }
  if (a[0] > s) {
    tim = (a[0] + t);
    b[top].tim = a[0] - 1;
    b[top].tim = min(s, b[top].tim);
    b[top].cost = 0;
    top++;
  } else {
    tim = (s + t);
    b[top].tim = a[0] - 1;
    b[top].cost = s - b[top].tim;
    top++;
  }
  for (i = 1; i < n; i++) {
    if (a[i] > s) {
      if (a[i] - a[i - 1] > 1) {
        b[top].cost = tim > (a[i] - 1) ? tim - a[i] + 1 : 0;
        b[top++].tim = a[i] - 1;
      }
    } else {
      b[top].cost = i * t + (s - a[i] + 1);
      b[top++].tim = a[i] - 1;
    }
    if (tim > a[i]) {
      tim += t;
    } else {
      tim = a[i] + t;
    }
    if (d - tim + 1 < t) break;
  }
  if (d - tim >= t) return 0 * printf("%lld\n", tim);
  sort(b, b + top, cmp);
  printf("%lld\n", b[0].tim);
}
