#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include<bitset>
#include <utility>
using namespace std;
#define rank rankk
#define mp make_pair
#define pb push_back
#define xo(a,b) ((b)&1?(a):0)
//#define LL ll
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<ll,int> pli;
const int INF=0x3f3f3f3f;
const ll INFF=0x3f3f3f3f3f3f3f3fll;
const int MAX=1e5+5;
const int MAX_N=MAX;
const ll MOD=998244353;
const long double pi=acos(-1.0);
//const double eps=0.00000001;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<class T> inline
void read(T& num) {
    bool start=false,neg=false;
    char c;
    num=0;
    while((c=getchar())!=EOF) {
        if(c=='-') start=neg=true;
        else if(c>='0' && c<='9') {
            start=true;
            num=num*10+c-'0';
        } else if(start) break;
    }
    if(neg) num=-num;
}
inline ll powMM(ll a,ll b,ll M){
    ll ret=1;
    a%=M;
//    b%=M;
    while (b){
        if (b&1) ret=ret*a%M;
        b>>=1;
        a=a*a%M;
    }
    return ret;
}
void open()
{
    freopen("1009.in","r",stdin);
    freopen("out.txt","w",stdout);
}
int a[MAX],b[MAX],c[MAX],r[MAX];
int x,k,dis,t,st;
int q;
int gps(int x)
{
    int l=1,ri=k,mid,an=0;
    while(l<=ri)
    {
        mid=(l+ri)>>1;
        if(r[mid]>x)
            ri=mid-1;
        else
            an=mid,l=mid+1;
    }
    return an;
}
int main()
{
    scanf("%d%d",&x,&k);
    for(int i=1;i<=k;i++)scanf("%d",&r[i]);
    a[0]=0;b[0]=x;c[0]=0;
    for(int i=1;i<=k;i++)
    {
        dis=r[i]-r[i-1];
        t=st%2?(x-dis):dis;
//        t=st%2?max(0,x-dis):min(x,dis);
        if(st%2){//向上
            if(t>=b[i-1]+c[i-1]){c[i]=c[i-1]+dis;a[i]=a[i-1];b[i]=b[i-1];}
            else if(t>a[i-1]+c[i-1]&&t<b[i-1]+c[i-1])
            {
                int tem=t-c[i-1];b[i]=tem;a[i]=a[i-1];c[i]=c[i-1]+dis;
            }
            else
                a[i]=b[i]=x,c[i]=0;
//            c[i]=min(c[i],x);
        }
        else//向下
        {
            if(t<=a[i-1]+c[i-1]){c[i]=c[i-1]-dis;a[i]=a[i-1];b[i]=b[i-1];}
            else if(t>a[i-1]+c[i-1]&&t<b[i-1]+c[i-1])
            {
                int tem=t-c[i-1];a[i]=tem;b[i]=b[i-1];c[i]=c[i-1]-dis;
            }
            else a[i]=b[i]=x,c[i]=-x;
//            c[i]=max(0,c[i]);
        }
        st^=1;
    }
    scanf("%d",&q);
//    for(int i=1;i<=k;i++)
//        printf("a=%d b=%d c=%d\n",a[i],b[i],c[i]);
    while(q--)
    {
        int temt,tema;scanf("%d%d",&temt,&tema);
        int id=gps(temt);int dir=(id&1)^1,an=0;//为1则向下 为0则向上
//        printf("id=%d! dir=%d %d %d he=%d\n",id,dir,temt,r[id],a[id]+c[id]);
        if(tema<=a[id])
            an=a[id]+c[id]+(dir?-1:1)*(temt-r[id]);
        else if(tema<b[id])
            an=c[id]+tema+(dir?-1:1)*(temt-r[id]);
        else an=b[id]+c[id]+(dir?-1:1)*(temt-r[id]);
//        printf("an=%d!\n",an);
        an=min(an,x);an=max(an,0);
        printf("%d\n",an);
    }
    return 0;
}
/*
180
4
60 300 1000 1170
100
*/


Measured memory_bytes: 2816