#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], x);
            ts[i].min = r[i] - r[i-1];
            //ts[i].uthr = x - (r[i] - r[i-1]);
            ts[i].lthr = x - ts[i-1].max;
        } else {
            ts[i].max = max(ts[i-1].max - r[i], 0);
            ts[i].min = max(ts[i-1].min - r[i], 0);
            //ts[i].uthr = 0;
            //ts[i].lthr = 0;
        }
    }
    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,x-t) << endl;
            continue;
        }
        int num = distance(begin(r), it) - 1;
        t -= r[num];
        if (num % 2) {
            if (a <= x - (ts[num].max - ts[num].min)) {
                cout << max(ts[num].min + a - t, 0) << endl;
            } else {
                cout << max(ts[num].max - t, 0) << endl;                
            }
        } else {
            if (a <= x - (ts[num].max - ts[num].min)) {
                cout << min(ts[num].min + t, x) << endl;
            } else {
                cout << min(ts[num].min + a + t, 0) << endl;                
            }
        }
    }
    
    return 0;
}