#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double

int main() {
    ll X, K;
    cin >> X >> K;
    vector<ll> R(K+2, 0);
    for (int i = 1; i <= K; i++) scanf("%lld", &R[i]);
    R[K+1] = 1e18;
    int Q;
    cin >> Q;
    vector<ll> T(Q), A(Q);
    for (int i = 0; i < Q; i++) scanf("%lld %lld", &T[i], &A[i]);
    int pos = 0;
    bool increase = true;
    ll l = 0, r = X, smin = 0;
    vector<ll> ans(Q, 0);
    for (int i = 0; i <= K; i++) {
        increase = !increase;
        //cout << l << " " << r << " " << smin << endl;
        while (pos < Q && T[pos] < R[i+1]) {
            if (increase) ans[pos] = clamp(clamp(A[pos], l, r)-l+smin+T[pos]-R[i], 0LL, X);
            else ans[pos] = clamp(clamp(A[pos], l, r)-l+smin-(T[pos]-R[i]), 0LL, X);
            pos++;
        }
        if (increase) {
            if (r-l+(R[i+1]-R[i]) >= X) {
                r = max(l, X-(R[i+1]-R[i])+l);
            }
            smin = min(X, smin+R[i+1]-R[i]);
        }
        else {
            if (r-l+(R[i+1]-R[i]) >= X) {
                l = min(r, r-(X-(R[i+1]-R[i])));
            }
            smin = max(0LL, smin-(R[i+1]-R[i]));
        }
    }
    
    for (int i = 0; i < Q; i++) printf("%lld\n", ans[i]);
    return 0;
}
