#include <iostream>
using namespace std;

int main(void){
    int X, K, Q, t, upperPart;
    cin >> X >> K;
    int r[K+1]={0};
    for(int i=1; i<=K; i++) cin >> r[i];

    for(cin>>Q; Q; Q--){
        cin >> t >> upperPart;
        int check = K;
        for(int i=1; i<=K; i++){
            if(r[i]>t){
                check = i-1;
                break;
            }
            if(upperPart-(r[i]-r[i-1]) >= 0){
                upperPart = X - upperPart + r[i]-r[i-1];
            }else{
                upperPart = X;
            }
        }

        if(upperPart-(t-r[check]) >= 0){
            upperPart = upperPart - t + r[check];
        }else{
            upperPart = 0;
        }

        if(check%2){
            cout << X-upperPart << endl;
        }else{
            cout << upperPart <<endl;
        }
    }

    return 0;
}