Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N, M := sc.nextInt(), sc.nextInt()
	m := sc.nextIntSlice(M)
	m = append(m, N)
	Q := sc.nextInt()
	l := sc.nextIntSlice(Q)
	base := m[0] - 1
	sums := make([]int, N+1)
	for i := 1; i <= M; i++ {
		var diff int
		if i != M {
			diff = m[i] - m[i-1] - 1
		} else {
			diff = m[i] - m[i-1]
		}
		for j := 0; j < diff; j++ {
			sums[j+1] += diff - j
		}
	}
	for _, allow := range l {
		ok := N + 1
		ng := 0
		for abs(ok-ng) > 1 {
			mid := (ok + ng) / 2
			if base+sums[mid] <= allow {
				ok = mid
			} else {
				ng = mid
			}
		}
		if ok == N+1 {
			fmt.Fprintln(wtr, -1)
		} else {
			fmt.Fprintln(wtr, ok)
		}
	}

	wtr.Flush()
}

C++: #include <iostream>
#include <algorithm>
#include <utility>

using namespace std;
int accumFailTime[100001];
int ac_k[100001];
int ac[100001];
int failTime[100001];
int firstZeroLen = -1;
int main() {
    int N, M;
    int m[100001];
    int Q;
    int l[100001];
    cin >> N >> M;
    for (int i=0; i<M; i++) cin >> m[i];
    cin >> Q;
    for (int i=0; i<Q; i++) cin >> l[i];

    int m_head = 0;
    int zero_len = 0;
    for (int i=1; i<=N; i++) {
        if (m_head < M && m[m_head] == i) {
            if (zero_len > 0) {
                accumFailTime[zero_len]++;
            }
            if (firstZeroLen == -1) firstZeroLen = zero_len;
            zero_len = 0;
            m_head++;
        }
        else {
            zero_len++;
        }
    }
    if (zero_len > 0) {
        accumFailTime[zero_len]++;
    }
    if (firstZeroLen == -1) firstZeroLen = zero_len;

    int ak = 0;
    int a = 0;
    for (int i=N; i>=1; i--) {
        ak += i * accumFailTime[i];
        a += accumFailTime[i];
        ac_k[i] = ak;
        ac[i] = a;
    }
    for (int i=1; i<=N; i++) {
        failTime[i] = ac_k[i] - ac[i] * (i-1);
        if (firstZeroLen > 0) {
            if (i == 2) failTime[2] += 1;
            if (i > 2 && firstZeroLen >= i) failTime[i] += i-1;
            if (i > 2 && firstZeroLen < i) failTime[i] += firstZeroLen;
        } 
        failTime[i] *= -1;

        //cerr << "failtime:" << i << ":" << failTime[i] << endl;
    }
    //cerr << endl;

    for (int i=0; i<Q; i++) {
        int* index = lower_bound(failTime+1, failTime+N+1, -l[i]);
        int answer = index - failTime;
        if (answer > N) answer = -1;
        cout << answer << endl;
    }   
        
    return 0;
}

C++: // includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
// #include<deque>
// #include<multiset>
// #include<bitset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int n, m;
int x[112345];
int ch[112345];
int lost[112345];

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  cin >> n >> m;
  vector<int> v;
  int now = n - m;
  for(int i = 0; i < m; i++) cin >> x[i], ch[x[i]] = 1, v.emplace_back(x[i]);

  lost[1] = now;
  for(int i = 2; i <= n; i++) {
    vector<int> nv;
    for(auto e : v) {
      if(e == n || ch[e+1]) {
      } else {
        ch[e+1] = 1;
        now--;
        nv.emplace_back(e + 1);
      }
    }
    v = nv;
    lost[i] = now;
  }

  int q;
  cin >> q;
  vector<int> ans(int(1e5) + 1, -1);
  int head = n;
  for(int i = 0; i <= int(1e5); i++) {
    while(head >= 1 && lost[head] <= i) head--;
    ans[i] = head == n ? -1 : head + 1;
  }

  for(int i = 0; i < q; i++) {
    int x;
    cin >> x;
    cout << ans[x] << "\n";
  }
  
  return 0;
}

C++: // template version 1.14
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define int long long
const int INF=1e18;
const int MOD=1e9+7;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define ceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int n,m;
vector<int> x;

signed main() {
  cin>>n>>m;

  x.resize(m);
  vi d;
  rep(i, m) { cin>>x[i]; }
  x.pb(n+1);
  rep(i, 1, m+1){
    d.pb(x[i]-x[i-1]);
  }
  sort(all(d));
  dump(d);

  vi dp(n+1);
  dp[1] = n-m;
  rep(y, 2, n+1){
    int x = posl(d, y);
    int v = (sz(d)) - x;
    dump(y, x);
    dp[y] = dp[y-1]-v;
  }
  dump(dp);

  vi ans(100001, -1);
  rrep(i, 1, n+1){
    ans[dp[i]] = i;
  }
  rep(i, 1, 100001){
    if (ans[i]==-1) ans[i]=ans[i-1];
  }

  int Q;cin>>Q;
  rep(i, Q) {
    int s;cin>>s;
    cout << ans[s] << endl;
  }
  return 0;
}