#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

struct T {
    int max, min, uthr, lthr;
    T() {}
    T(int a, int b, int c, int d):max(a),min(b),uthr(c),lthr(d){}
};

int main() {
    int x,k;
    cin >> x >> k;
    VI r(k);
    REP(i,0,k) cin >> r[i];
    vector<T> ts(k);
    ts[0].max = max(x - r[0],0);
    ts[0].min = 0;
    ts[0].uthr = x;
    ts[0].lthr = r[0];
    REP(i,1,k) {
        if (i % 2) {
            ts[i].max = min(ts[i-1].max + r[i] - r[i-1], x);
            ts[i].min = min(ts[i-1].min + r[i] - r[i-1], x);
            ts[i].lthr = ts[i-1].lthr;
            if (ts[i-1].max + (r[i] - r[i-1]) <= x) {
                ts[i].uthr = ts[i-1].uthr;
            } else {
                //ts[i].uthr -= ts[i-1].max + min(ts[i-1].max, r[i] - r[i-1]) - x;
                ts[i].uthr = ts[i].lthr + ts[i].max - ts[i].min;
            }
        } else {
            ts[i].max = max(ts[i-1].max - r[i] + r[i-1], 0);
            ts[i].min = max(ts[i-1].min - r[i] + r[i-1], 0);
            ts[i].uthr = ts[i-1].uthr;
            if (ts[i-1].min - (r[i] - r[i-1]) >= 0) {
                ts[i].lthr = ts[i-1].lthr;
            } else {
                //ts[i].lthr += ts[i-1].min - min(ts[i-1].min, r[i] - r[i-1]);
                ts[i].lthr = ts[i].uthr - (ts[i].max - ts[i].min);
            }
        }
    }
    REP(i,0,k) {
        cerr << r[i] << ": " << ts[i].max << " " << ts[i].min << " " << ts[i].uthr << " " << ts[i].lthr << endl;
    }
    r.push_back(1000000009);
    int q;
    cin >> q;
    int t,a;
    REP(i,0,q) {
        cin >> t >> a;
        //cout << t << a << endl;
        auto it = upper_bound(all(r), t);
        if (it == begin(r)) {
            cout << max(0,a-t) << endl;
            continue;
        }
        int num = distance(begin(r), it) - 1;
        t -= r[num];
        int base;
        if (a >= ts[num].uthr) base = ts[num].max;
        else if (a <= ts[num].lthr) base = ts[num].min;
        else base = a - ts[num].lthr + ts[num].min;
        if (num % 2) {
            cout << max(0, base - t) << endl;
        } else {
            cout << min(x, base + t) << endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 3192