#include<cstdio>
const long long inf = 1e17+7;
long long r[100005];
long long prefix[100005];
int f[100005][18];
long long spt[2][100005][18];
int pow2[25]; int log2[100005];

long long min(long long a,long long b){ return a>b?b:a; }

long long max(long long a,long long b){ return a>b?a:b; }


long long stMax(int l,int r){
    int k = log2[r-l+1];
    return max(spt[1][l][k],spt[1][r-pow2[k]+1][k]);
}

long long stMin(int l,int r){
    int k = log2[r-l+1];
    return min(spt[0][l][k],spt[0][r-pow2[k]+1][k]);
}
/*
long long stMax(int l,int r){
    long long res = -inf;
    for(int i = l; i <= r; i++) if(prefix[i]>res) res = prefix[i]; 
    return res;
}
 
long long stMin(int l,int r){
    long long res = inf;
    for(int i = l; i <= r; i++) if(prefix[i]<res) res = prefix[i];
    return res;
}
*/
int getNextStep(int p,long long have,long long x,int n){
    int L = p+1, R = n;
    int res = n+1;
    while(L<=R){
        int M = (L+R)/2;
        long long maxC = stMax(p+1,M)-prefix[p], minC = stMin(p+1,M)-prefix[p];
        if(have+maxC>=x || have+minC<=0){
            res = M;
            R = M-1;
        }
        else L = M+1;
    }
    return res;
}

void preWork(int n,long long x){
    //sp-Table...
    for(int i = 1; i <= n; i++) spt[0][i][0] = spt[1][i][0] = prefix[i];
    pow2[0] = 1;
    for(int j = 1; j <= 17; j++){
        pow2[j] = pow2[j-1]*2;
        for(int i = 1; i <= n; i++){
            if(i+pow2[j]-1>n) continue;
            else{
                spt[0][i][j] = min(spt[0][i][j-1],spt[0][i+pow2[j-1]][j-1]);
                spt[1][i][j] = max(spt[1][i][j-1],spt[1][i+pow2[j-1]][j-1]);
            }
        }
    }
    int base = 1; log2[1] = 0;
    for(int i = 2; i <= n; i++){
        log2[i] = log2[i-1];
        if(base*2<=i) base *= 2, log2[i]++;
    }
    //j pointer
    f[n][0] = 0;
    for(int i = n-1; i >= 1; i--){
        long long have = -1;
        if(i%2) have = 0;
        else have = x;
        f[i][0] = getNextStep(i,have,x,n);
    }
    for(int j = 1; j <= 17; j++){
        for(int i = 1; i <= n; i++){
            int last = f[i][j-1];
            if(last==0) f[i][j] = 0;
            else f[i][j] = f[last][j-1];
        }
    }
}

int getPtr(int u,long long t){
    for(int i = 17; i >= 0; i--){
        if(f[u][i]!=0 && r[f[u][i]]<=t){
            u = f[u][i];
        }
    }
    return u;
}

int getLast(long long t,int n){
    int L = 0, R = n;
    int res = -1;
    while(L<=R){
        int M = (L+R)/2;
        if(r[M]<=t){
            res = M;
            L = M+1;  
        }
        else R = M-1;
    }
    return res;
}

int main(){
    long long x; int n;
    scanf("%lld%d",&x,&n);
    r[0] = 0, prefix[0] = 0;
    for(int i = 1; i <= n; i++){
        scanf("%lld",&r[i]);
        if(i%2) prefix[i] = prefix[i-1]-(r[i]-r[i-1]);
        else prefix[i] = prefix[i-1]+(r[i]-r[i-1]);
    }
    prefix[n+1] = r[n+1] = inf;
    preWork(n,x);
    int q;
    scanf("%d",&q);
    for(int rnd = 0; rnd < q; rnd++){
        long long t,a;
        scanf("%lld%lld",&t,&a);
        int next = getNextStep(0,a,x,n);
        //printf("next = %d\n",next);
        if(r[next]>=t){
            int last = getLast(t,next);
            a += prefix[last];
            long long left = t-r[last];
            if(last%2) a += left;
            else a -= left;
            if(a<0) a = 0;
            if(a>x) a = x;
            printf("%lld\n",a);
        }
        else{
            int cur = getPtr(next,t);
            //while(r[f[cur][0]]<=t) cur = f[cur][0];
            long long have = -1;
            if(cur%2) have = 0;
            else have = x;
            //and a long road to go...
            int last = getLast(t,n);
            a = have+prefix[last]-prefix[cur];
            long long left = t-r[last];
            if(last%2) a += left;
            else a -= left;
            if(a<0) a = 0;
            if(a>x) a = x;
            printf("%lld\n",a);
        }
    }
    return 0;
}


Measured memory_bytes: 38828