#include <bits/stdc++.h>

#define fr first
#define sc second
#define OK puts("OK");
#define pb push_back
#define mk make_pair

using namespace std;

typedef long long ll;

const int inf = (int)1e9 + 7;
const int N = (int)1e5 + 7;

ll x;
int n,q;
int cur;
int a[N];
int tt,l;
ll ans,t[N],s[N];

 main () {
        cin >> x;
        cin >> n;

        for (int i = 1; i <= n; i ++) {
                cin >> a[i];
                t[i] = a[i] - a[i - 1];
        }
        cin >> q;

        for (int i = 1; i <= q; i ++) {
                cin >> tt >> l;
                int pos = upper_bound(a + 1,a + n + 1,tt) - a - 1;
                int A = l,B = x - l;
                for (int j = 1; j <= pos; j ++) {
                        if (j % 2)
                                A = max(0ll,A - t[j]);
                        else
                                A = min(x,A + t[j]);
                }
                ans = tt - a[pos];
                if (pos % 2)
                        A = min(x,A + ans);
                else
                        A = max(0ll,A - ans);
                cout << A << endl;
        }

}
