#include <bits/stdc++.h>
using namespace std;

#define int long long
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
constexpr int DX[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int sign(int x) { return (x > 0) - (x < 0); }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const deque<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const set<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const map<T, U> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int X, K;
int r[110000];
int Q;
int t[110000], a[110000];
signed main() {
    cin >> X >> K;
    vpint seg{{0, 0}};
    int sgn = 1;
    rep(i, K) { cin >> r[i]; }
    r[K] = 4e9, r[K + 1] = 9e9;
    K += 2;
    rep(i, K) { seg.emplace_back(pint(r[i], seg.back().second + (r[i] - r[i - 1]) * (sgn *= -1))); }
    vpint peaku{{0, 0}}, peakd{{0, 0}}, segu{{0, X}}, segd{{0, 0}};
    {
        int p = 0;
        reps(i, K) {
            pint s = seg[i];
            if (chmax(p, s.second)) { peaku.emplace_back(pint(s.second, s.first)); }
            pint nxt = {s.first, s.second - seg[i - 1].second + segu.back().second};
            if (0 <= nxt.second && nxt.second <= X) { segu.emplace_back(nxt); }
            else if (nxt.second > X) {
                if (segu.back().second == X) { segu.emplace_back(nxt.first, X); }
                else {
                    segu.emplace_back(pint(nxt.first - (nxt.second - X), X));
                    segu.emplace_back(pint(nxt.first, X));
                }
            } else if (nxt.second < 0) {
                if (segu.back().second == 0) { segu.emplace_back(nxt.first, 0); }
                else {
                    segu.emplace_back(pint(nxt.first + nxt.second, 0));
                    segu.emplace_back(pint(nxt.first, 0));
                }
            }
        }
    }
    {
        int p = 0;
        reps(i, K) {
            pint s = seg[i];
            if (chmin(p, s.second)) { peakd.emplace_back(pint(s.second, s.first)); }
            pint nxt = {s.first, s.second - seg[i - 1].second + segd.back().second};
            if (0 <= nxt.second && nxt.second <= X) { segd.emplace_back(nxt); }
            else if (nxt.second > X) {
                if (segd.back().second == X) { segd.emplace_back(nxt.first, X); }
                else {
                    segd.emplace_back(pint(nxt.first - (nxt.second - X), X));
                    segd.emplace_back(pint(nxt.first, X));
                }
            } else if (nxt.second < 0) {
                if (segd.back().second == 0) { segd.emplace_back(nxt.first, 0); }
                else {
                    segd.emplace_back(pint(nxt.first + nxt.second, 0));
                    segd.emplace_back(pint(nxt.first, 0));
                }
            }
        }
    }
    cin >> Q;
    rep(i, Q) {
        cin >> t[i] >> a[i];
        int tu = lower_bound(all(peaku), pint(X - a[i], 0))->second;
        int td = lower_bound(all(peakd), pint(-a[i], 0), [](pint l, pint r) { return l > r; })->second;
        vpint::iterator p;
        if (t[i] < min(tu, td)) {
            p = lower_bound(all(seg), pint(t[i], LLONG_MAX)) - 1;
            cout << clamp(a[i] + p->second + (t[i] - p->first) * sign((p + 1)->second - p->second), 0LL, X) << endl;
        } else {
            if (tu < td) { p = lower_bound(all(segu), pint(t[i], LLONG_MAX)) - 1; }
            else { p = lower_bound(all(segd), pint(t[i], LLONG_MAX)) - 1; }
            cout << clamp(p->second + (t[i] - p->first) * sign((p + 1)->second - p->second), 0LL, X) << endl;
        }
    }
}

Measured memory_bytes: 14820