#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define INF (1LL<<60)
typedef pair<int,int> P;

int main(){
    ll x;
    int k;
    cin >> x >> k;
    vector<ll>t;
    t.push_back(0);
    rep(i,k){
        ll tmp;
        cin >> tmp;
        t.push_back(tmp);
    }
    vector<pair<ll,ll> >up,lo;
    up.push_back(MP(x,x));
    lo.push_back(MP(0,0));
    rep(i,k){
        if(i%2==0){
            //cerr << i << " " << t[i+1] << " " << t[i] << endl;
            if(up[i].first >t[i+1]-t[i]){
                up.push_back(MP(up[i].first-(t[i+1]-t[i]),up[i].second));
            }else{
                up.push_back(MP(0,up[i].second + (t[i+1]-t[i])- up[i].first ));
            }
            if(lo[i].first >t[i+1]-t[i]){
                lo.push_back(MP(lo[i].first-(t[i+1]-t[i]),lo[i].second));
            }else{
                lo.push_back(MP(0,lo[i].second + (t[i+1]-t[i])- lo[i].first ));
            }
        }else{
            ll d =  t[i+1]-t[i];
            if(up[i].first+ d > x){
                up.push_back(MP(x,up[i].second - (up[i].first+ d-x)));
            }else{
                up.push_back(MP(up[i].first + d,up[i].second));
            }
            if(lo[i].first+ d > x){
                lo.push_back(MP(x,up[i].second - (lo[i].first+ d-x)));
            }else{
                lo.push_back(MP(lo[i].first + d,lo[i].second));
            }
        }
    }
    // for(auto x:up){
    //     cerr << x.first << " " << x.second << endl;
    // }
    // for(auto x:lo){
    //     cerr << x.first << " " << x.second << endl;
    // }
    int q;
    cin >> q;
    rep(xx,q){
        ll tm,a;
        cin >> tm >> a;
        ll res = 0;
        int id = upper_bound(t.begin(),t.end(),tm) - t.begin() -1;
        //cerr << t[id] << " " << up[id].first << " " << up[id].second << " " << lo[id].first << " " << lo[id].second << endl;
        if(up[id].first == lo[id].first){
            if(id%2==0){
                res = up[id].first - (tm-t[id]);
                cout << max(res,0LL) << endl;
            }else{
                res = up[id].first + (tm-t[id]);
                cout << min(res,x) << endl;
            }
        }else{
            if(id%2==0){
                ll kk;
                if(up[id].second < a){
                    kk = up[id].first;
                }else if(lo[id].second < a){
                    kk = lo[id].first + a-lo[id].second;
                }else{
                    kk = lo[id].first;
                }
                res = kk - (tm-t[id]);
                cout << max(res,0LL) << endl;
            }else{
                ll kk;
                if(up[id].second < a){
                    kk = up[id].first;
                }else if(lo[id].second < a){
                    kk = lo[id].first + a-lo[id].second;
                }else{
                    kk = lo[id].first;
                }
                res = kk + (tm-t[id]);
                cout << min(res,x) << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 5268