#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
#define debug(x) cout << #x << '=' << x << '\n'
const long long MOD=1e9+7;
//const long long MOD=998244353;
const int INF=1e9;
const long long IINF=1e18;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
const char dir[4]={'D','R','U','L'};

template<typename T>
istream &operator>>(istream &is,vector<T> &v){
    for (T &x:v) is >> x;
    return is;
}
template<typename T>
ostream &operator<<(ostream &os,const vector<T> &v){
    for (int i=0;i<v.size();++i){
        os << v[i] << (i+1==v.size()?"": " ");
    }
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const pair<T,U> &p){
    cout << '(' << p.first << ',' << p.second << ')';
    return os;
}

template<class T1,class T2> inline bool chmin(T1 &a,T2 b){
    if (a>b){a=b; return true;} return false;
}
template<class T1,class T2> inline bool chmax(T1 &a,T2 b){
    if (a<b){a=b; return true;} return false;
}

template<typename Monoid>
struct SegmentTree{
    typedef function<Monoid(Monoid,Monoid)> F;
    int n;
    F f;
    Monoid id;
    vector<Monoid> dat;
    SegmentTree(int n_,F f,Monoid id):f(f),id(id){init(n_);}
    void init(int n_){
        n=1;
        while(n<n_) n<<=1;
        dat.assign(n<<1,id);
    }
    void build(const vector<Monoid> &v){
        for (int i=0;i<v.size();++i) dat[i+n]=v[i];
        for (int i=n-1;i;--i) dat[i]=f(dat[i<<1|0],dat[i<<1|1]);
    }
    void update(int k,Monoid x){
        dat[k+=n]=x;
        while(k>>=1) dat[k]=f(dat[k<<1|0],dat[k<<1|1]);
    }
    Monoid query(int a,int b){
        if (a>=b) return id;
        Monoid vl=id,vr=id;
        for (int l=a+n,r=b+n;l<r;l>>=1,r>>=1){
            if (l&1) vl=f(vl,dat[l++]);
            if (r&1) vr=f(dat[--r],vr);
        }
        return f(vl,vr);
    }
    Monoid operator[](int i){
        return dat[i+n];
    }
    // most left position that meets condition "check"
    template<typename C>
    int find(int a,int b,const C &check,int k,int l,int r){
        if (!check(dat[k])||r<=a||b<=l) return -1;
        if (l+1==r) return k-n;
        int vl=find(a,b,check,k<<1|0,l,(l+r)>>1);
        if (~vl) return vl;
        return find(a,b,check,k<<1|1,(l+r)>>1,r);
    }
    template<typename C>
    int find(int a,int b,const C &check){
        return find(a,b,check,1,0,n);
    }
};

const int MAX_LOG=20;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int X,K; cin >> X >> K;
    vector<int> r(K+2);
    r[0]=0,r[K+1]=INF;
    for (int i=1;i<=K;++i) cin >> r[i];
    vector<int> sum(K+2);
    for (int i=0;i<K+1;++i){
        if (i&1) sum[i+1]=sum[i]+(r[i+1]-r[i]);
        else sum[i+1]=sum[i]-(r[i+1]-r[i]);
    }
    auto f1=[](int a,int b){return min(a,b);};
    auto f2=[](int a,int b){return max(a,b);};
    SegmentTree<int> seg1(K+2,f1,INF),seg2(K+2,f2,-INF);
    seg1.build(sum); seg2.build(sum);
    vector<vector<int>> nxt(K+2,vector<int>(MAX_LOG,-1));
    for (int i=1;i<K+2;++i){
        if (i&1){
            auto c1=[&](int x){return x<=sum[i];};
            auto c2=[&](int x){return x>=sum[i]+X;};
            int n1=seg1.find(i+1,K+2,c1),n2=seg2.find(i+1,K+2,c2);
            nxt[i][0]=(~n1?(~n2?min(n1,n2):n1):n2);
        } else {
            auto c1=[&](int x){return x<=sum[i]-X;};
            auto c2=[&](int x){return x>=sum[i];};
            int n1=seg1.find(i+1,K+2,c1),n2=seg2.find(i+1,K+2,c2);
            nxt[i][0]=(~n1?(~n2?min(n1,n2):n1):n2);
        }
    }
    for (int j=0;j<MAX_LOG-1;++j)
        for (int i=1;i<K+2;++i)
            if (~nxt[i][j])
                nxt[i][j+1]=nxt[nxt[i][j]][j];
    int Q; cin >> Q;
    for (;Q--;){
        int t,a; cin >> t >> a;
        auto c1=[&](int x){return x+a<=0;};
        auto c2=[&](int x){return x+a>=X;};
        int n1=seg1.find(1,K+2,c1),n2=seg2.find(1,K+2,c2);
        int now=(~n1?(~n2?min(n1,n2):n1):n2);
        if (now<0||t<r[now]) now=0;
        if (now){
            for (int j=MAX_LOG-1;j>=0;--j){
                if (nxt[now][j]<0) continue;
                if (t<r[nxt[now][j]]) continue;
                now=nxt[now][j];
            }
        }
        int ans=(!now?a:(now&1?0:X));
        int last=upper_bound(r.begin(),r.end(),t)-r.begin()-1;
        ans+=sum[last]-sum[now];
        if (last&1) ans+=t-r[last];
        else ans-=t-r[last];
        cout << min(X,max(0,ans)) << '\n';
    }
}

Measured memory_bytes: 15744