#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln = '\n';
constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true;} return false; }
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return true;} return false; }
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
void print() { cout << "\n"; }
template<class T, class... Args>
void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    ll X,K; cin >> X >> K;
    vector<ll> r(K+1);
    rep(i,K) cin >> r[i+1];

    vector<ll> L(K+1),R(K+1,X),A(K+1),A0(K+1),AX(K+1,X);
    rep(i,K) {
        L[i+1] = L[i];
        R[i+1] = R[i];       
        if (~i&1) {
            A[i+1] = A[i]-(r[i+1]-r[i]);
            A0[i+1] = max(0LL,A0[i]-(r[i+1]-r[i]));
            AX[i+1] = max(0LL,AX[i]-(r[i+1]-r[i]));
        } else {
            A[i+1] = A[i]+(r[i+1]-r[i]);
            A0[i+1] = min(X,A0[i]+(r[i+1]-r[i]));
            AX[i+1] = min(X,AX[i]+(r[i+1]-r[i]));
        }
        if (A[i+1] <= 0) chmax(L[i+1],-A[i+1]);
        if (A[i+1] >= X) chmin(R[i+1],X*2-A[i+1]);
    }
    int Q; cin >> Q;
    while (Q--) {
        ll t,a;
        cin >> t >> a;
        int k = upper_bound(all(r),t) - r.begin();
        k--;
        ll ans = 0;
        if (a <= L[k]) {
            ans = A0[k];
        } else if (a >= R[k]) {
            ans = AX[k];
        } else {
            ans = a + A[k];
        }
        if (k&1) ans = min(X,ans+(t-r[k]));
        else ans = max(0LL,ans-(t-r[k]));
        cout << ans << ln;
    }
}
