#include <bits/stdc++.h>

using namespace std;

#define sqr(x) ((x) * (x))
#define pb push_back
#define mp make_pair
#define ins insert
#define X first
#define Y second
#define fin(name) freopen(name, "r", stdin)
#define fout(name) freopen(name, "w", stdout)
#define files(name) fin(name".in"); fout(name".out")
#define endl "\n"
#define fi(st,n) for (int i = (st); i <= (int)(n); ++i)
#define fj(st,n) for (int j = (st); j <= (int)(n); ++j)
#define fk(st,n) for (int k = (st); k <= (int)(n); ++k)
#define fq(st,n) for (int q = (st); q <= (int)(n); ++q)
#define fw(st,n) for (int w = (st); w <= (int)(n); ++w)
#define ff(i, st, n) for (int (i) = (st); (i) <= (int)(n); ++(i))
#define ei(st,n) for (int i = (st); i >= (int)(n); --i)
#define ej(st,n) for (int j = (st); j >= (int)(n); --j)
#define ek(st,n) for (int k = (st); k >= (int)(n); --k)
#define ef(i, st, n) for (int (i) = (st); (i) >= (int)(n); --(i))
#define ri(st,n) for (int i = (st); i < (int)(n); ++i)
#define rj(st,n) for (int j = (st); j < (int)(n); ++j)
#define rk(st,n) for (int k = (st); k < (int)(n); ++k)
#define rq(st,n) for (int q = (st); q < (int)(n); ++q)
#define rf(i, st, n) for (int (i) = (st); (i) < (int)(n); ++(i))
#define clean(a) memset((a),0,sizeof (a))
#define sync ios_base::sync_with_stdio(0);cin.tie(0)
#define y1 dsklmlvmd

typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const dbl eps = (dbl) 1e-8;
const int mod = (int) 1e9 + 7;
const int maxn = (int) 1e5 + 5;
const int MX = (int) 1e5;
const int LG = (int) 20;
//const dbl M_PI = (dbl)2 * (dbl)acos(0);

//cout<<fixed<<setprecision(15);
//srand(time(0));

ll t[maxn], r[maxn], tim;
ll X, k, s0[maxn], s1[maxn];
int p[maxn][LG + 1], nxt[maxn];
set <pair <ll, int> > q0, q1;


int get_next(int a, int b, int v)
{
	int o0 = k + 1, o1 =  k + 1;
	if (q1.size())
	{
		auto it = q1.lower_bound(mp(s1[v] - a, 0));
		if (it == q1.end() || (it->X != s1[v] - a && it != q1.begin()))
		{
			--it;
		}
		if (it->X <= s1[v] - a)
			o1 = it->Y;
	}
	if (q0.size())
	{
		auto it = q0.lower_bound(mp(s0[v] - b, 0));
		if (it == q0.end() || (it->X != s0[v] - b && it != q0.begin()))
		{
			--it;
		}
		if (it->X <= s0[v] - b)
			o0 = it->Y;
	}
	return min(o0, o1);
}

int main()
{
//    fin("t.in");
    sync;
    cin >> X;
    cin >> k;
    t[0] = 0;
    s0[0] = 0;
    s1[0] = 0; 
    fi(1, k)
    {
    	cin >> t[i];
    	r[i] = t[i] - t[i - 1];
    	s0[i] = s0[i - 1];
    	s1[i] = s1[i - 1];
    	if (i & 1)
    	{
    		s1[i] -= r[i];
    		s0[i] += r[i];
    	}
    	else
    	{
    		s1[i] += r[i];
    		s0[i] -= r[i];
    	}
    }
    t[k + 1] = inf + 5;
    ei(k, 1)
    {
    	if (i & 1)
	    	nxt[i] = get_next(0, X, i);
	    else
	    	nxt[i] = get_next(X, 0, i);

    	auto it = q0.ins(mp(s0[i], i)).X;
    	++it;
    	while (it != q0.end())
    	{
    		it = q0.erase(it);
    	}
    	it = q1.ins(mp(s1[i], i)).X;
    	++it;
    	while (it != q1.end())
    	{
    		it = q1.erase(it);
    	}
    }
    fj(0, LG)
    	p[k + 1][j] = k + 1;
    ei(k, 1)
    {
    	p[i][0] = nxt[i];
    	fj(1, LG)
    	{
    		p[i][j] = p[p[i][j - 1]][j - 1];
    	}
    }
    int T;
    cin >> T;
    ff(numt, 1, T)
    {
    	int tim, a;
    	cin >> tim >> a;
    	int v = get_next(a, X - a, 0);
    	if (t[v] > tim)
    	{
    		v = 0;
    	}
    	else
    	{
    		ej(LG, 0)
    		{
    			int u = p[v][j];
    			if (t[u] <= tim)
    				v = u;
    		}
    		if (v & 1)
    			a = 0;
    		else
    			a = X;
    	}
    	int u = lower_bound(t + v, t + k + 1, tim) - t;
    	if (t[u] > tim)
    		--u;
    	a = a + s1[u] - s1[v];
    	v = u;

    	if (v & 1)
    		cout << min(X, a + tim - t[v]) << endl;
    	else
    		cout << max(0ll, a - (tim - t[v])) << endl;
    }

    return 0;
}

Measured memory_bytes: 12928