#include <bits/stdc++.h>
using namespace std;
//#define DEBUG_MODE
#define endl '\n'
#ifdef DEBUG_MODE
#define DEBUG(X) debug_func(X, #X)
#define DEBUG_ENDL endl
#define DEBUG_SEPARATOR_LINE cout<<"=================\n"
#else
#define DEBUG(X) 0
#define DEBUG_ENDL 0
#define DEBUG_SEPARATOR_LINE 0
#endif
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
#define DEBUG_ENDL_S(S) ((S).size() ? "\n" : "")
template <typename T> using V = vector<T>;
template <typename T> using VV = vector<V<T>>;
template <typename T, typename U> using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename Head, typename... Tail> const Head& var_min(const Head &head, const Tail&... tail) { return min(head, var_min(tail...)); }
template <typename Head, typename... Tail> const Head& var_max(const Head &head, const Tail&... tail) { return max(head, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
void debug_func_preffix(const string &s) { if(s.size()) cout << s << " = "; }
template <typename T>
void debug_func(const T &t, const string &s = "") {
    debug_func_preffix(s);
    cout << t << DEBUG_ENDL_S(s);
}
template <typename T, typename U>
void debug_func(const P<T, U> &p, const string &s = "") {
    debug_func_preffix(s);
    cout << "(";
    debug_func(p.first);
    cout << ", ";
    debug_func(p.second);
    cout << ")" << DEBUG_ENDL_S(s);
}
template <typename T>
void debug_func(const V<T> &v, const string &s = "") {
    for(ll i = 0; i < v.size(); i++) {
        string t = s + "[" + to_string(i) + "]";
        debug_func(v[i], t);
    }
}

ll X, K;
V<ll> R;
V<PLL> sand_X, rsand_X;
V<ll> r_sum;
V<ll> r_max_a, r_max_b;

const ll INF = 5e15;

void calc_X() {
    PLL now = PLL(X, 0);
    PLL rnow = PLL(0, X);
    sand_X.push_back(now);
    rsand_X.push_back(rnow);
    for(ll i = 0; i < K; i++) {
        for(ll j = 0; j <= 1; j++) {
            auto &nowt = (j == 0 ? now : rnow);
            auto &sandt = (j == 0 ? sand_X : rsand_X);
            ll sand = (i % 2 == 0 ? nowt.first : nowt.second);
            chmin(sand, R[i + 1] - R[i]);
            nowt.first += (i % 2 == 0 ? -1 : 1) * sand;
            nowt.second += (i % 2 == 0 ? 1 : -1) * sand;
            sandt.push_back(nowt);
        }
    }
}

void calc_r_max() {
    r_sum = V<ll>(K + 1, 0);
    r_max_a = V<ll>(K + 1, 0);
    r_max_b = V<ll>(K + 1, 0);
    for(ll i = 0; i < K; i++) r_sum[i + 1] += r_sum[i] + (i % 2 == 0 ? -1 : 1) * (R[i + 1] - R[i]);
    for(ll i = 0; i < K; i++) {
        r_max_a[i + 1] = max(r_max_a[i], -1 * r_sum[i + 1]);
        r_max_b[i + 1] = max(r_max_b[i], r_sum[i + 1]);
    }
    r_max_a.push_back(INF);
    r_max_b.push_back(INF);
}

int main() {
    cin >> X >> K;
    R = V<ll>(K + 1, 0);
    for(ll i = 0; i < K; i++) {
        ll e;
        cin >> e;
        R[i + 1] = e;
    }
    R.push_back(INF);
    calc_X();
    calc_r_max();
    ll Q;
    cin >> Q;
    DEBUG(sand_X);
    DEBUG(rsand_X);
    DEBUG(r_sum);
    DEBUG(r_max_a);
    DEBUG(r_max_b);
    for(ll QQ = 0; QQ < Q; QQ++) {
        ll t, a;
        cin >> t >> a;
        ll idx = distance(R.begin(), upper_bound(ALL(R), t));
        idx--;
        ll nowa, nowb;
        DEBUG(a);
        DEBUG(r_max_a[idx]);
        DEBUG(X - a);
        DEBUG(r_max_b[idx]);
        if(a < r_max_a[idx] || (X - a) < r_max_b[idx]) {
            ll tmpidx = min(distance(r_max_a.begin(), upper_bound(ALL(r_max_a), a)),
                            distance(r_max_b.begin(), upper_bound(ALL(r_max_b), X - a)));
            tmpidx--;
            tie(nowa, nowb) = (tmpidx % 2 == 1 ? sand_X : rsand_X)[idx];
        } else {
            nowa = a + r_sum[idx];
            nowb = (X - a) - r_sum[idx];
        }
        ll pret = R[idx];
        ll restt = t - pret;
        ll sand = min(restt, (idx % 2 == 0 ? nowa : nowb));
        DEBUG(idx);
        DEBUG(restt);
        DEBUG(sand);
        nowa += (idx % 2 == 0 ? -1 : 1) * sand;
        cout << nowa << endl;
    }
    return 0;
}


Measured memory_bytes: 9448