//#define _GLIBCXX_DEBUG
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef long double ld;

#define mk make_pair
#define inb push_back
#define X first
#define Y second
#define all(v) v.begin(), v.end()
#define sqr(x) (x) * (x)
#define TIME 1.0 * clock() / CLOCKS_PER_SEC
#define y1 AYDARBOG
//continue break pop_back return

int solve();

int main()
{
    //ios_base::sync_with_stdio(0);
    //cin.tie(0);
#define TASK "lzss"
#ifndef _DEBUG
    //freopen(TASK".in", "r", stdin), freopen(TASK".out", "w", stdout);
#endif
    solve();
#ifdef _DEBUG
    fprintf(stderr, "\nTIME: %.3f\n", TIME);
#endif
}

struct Node
{
    int x, add, set;
    Node() { x = 0, add = 0, set = -1; };
    Node(int x) : x(x), add(0), set(-1) {};
};

Node min(Node a, Node b)
{
    if (a.x < b.x)
        return a;
    return b;
}

struct SegmentTree
{
    int n;
    vector<Node> t;
    SegmentTree() {};
    SegmentTree(vi &a)
    {
        n = a.size();
        t.resize(4 * n);
        build(0, 0, n - 1, a);
    }
    void build(int v, int tl, int tr, vi& a)
    {
        if (tl == tr)
        {
            t[v] = Node(a[tl]);
            return;
        }
        int tm = tl + tr >> 1;
        build(2 * v + 1, tl, tm, a);
        build(2 * v + 2, tm + 1, tr, a);
        t[v] = min(t[2 * v + 1], t[2 * v + 2]);
    }
    void push(int v, int tl, int tr)
    {
        if (t[v].set != -1)
        {
            t[v].x = t[v].set;
            if (tl != tr)
            {
                t[2 * v + 1].add = 0;
                t[2 * v + 2].add = 0;
                t[2 * v + 1].set = t[v].set;
                t[2 * v + 2].set = t[v].set;
            }
            t[v].set = -1;
        }
        if (t[v].add != 0)
        {
            t[v].x += t[v].add;
            if (tl != tr)
            {
                t[2 * v + 1].add += t[v].add;
                t[2 * v + 2].add += t[v].add;
            }
            t[v].add = 0;
        }
    }
    void update(int v, int tl, int tr, int l, int r, int val, int id)
    {
        if (l > r)
            return;
        push(v, tl, tr);
        if (tl > r || tr < l)
            return;
        if (l <= tl && tr <= r)
        {
            //0 - add
            //1 - set
            if (id)
            {
                t[v].set = val;
                push(v, tl, tr);
            }
            else
            {
                t[v].add += val;
                push(v, tl, tr);
            }
            return;
        }
        int tm = tl + tr >> 1;
        update(2 * v + 1, tl, tm, l, r, val, id);
        update(2 * v + 2, tm + 1, tr, l, r, val, id);
        t[v] = min(t[2 * v + 1], t[2 * v + 2]);
    }
    int get(int v, int tl, int tr, int pos)
    {
        push(v, tl, tr);
        if (tl == tr)
        {
            return t[v].x;
        }
        int tm = tl + tr >> 1;
        if (tl <= pos && pos <= tm)
            return get(2 * v + 1, tl, tm, pos);
        return get(2 * v + 2, tm + 1, tr, pos);
    }
};

int solve()
{
    int x;
    int k;
    scanf("%d %d", &x, &k);
    vi r(k + 1);
    for (int i = 1; i <= k; ++i)
    {
        scanf("%d", &r[i]);
    }
    ++k;
    int q;
    scanf("%d", &q);
    vector<pii> z(q);
    set<int> H;
    for (int i = 0; i < q; ++i)
    {
        scanf("%d %d", &z[i].X, &z[i].Y);
        H.insert(z[i].Y);
    }
    vector<int> a;
    for (auto x : H)
        a.inb(x);
    int n = a.size();
    SegmentTree T = SegmentTree(a);
    int i = 1, j = 0;
    while (j < q)
    {
        while (i < k && r[i] <= z[j].X)
        {
            int dr = r[i] - r[i - 1];
            if (i & 1)
            {
                //void update(int v, int tl, int tr, int l, int r, int val, int id)
                int l = -1, r = n;
                while (r - l > 1)
                {
                    int mid = l + r >> 1;
                    if (T.get(0, 0, n - 1, mid) <= dr)
                        l = mid;
                    else
                        r = mid;
                }
                int pos = l;
                //if (dr >= a[0])
                    T.update(0, 0, n - 1, 0, pos, 0, 1);
                T.update(0, 0, n - 1, pos + 1, n - 1, -dr, 0);
            }
            else
            {
                int l = -1, r = n;
                while (r - l > 1)
                {
                    int mid = l + r >> 1;
                    if (T.get(0, 0, n - 1, mid) <= x - dr)
                        l = mid;
                    else
                        r = mid;
                }
                int pos = l;
                //if (x - dr >= a[0])
                    T.update(0, 0, n - 1, 0, pos, dr, 0);
                T.update(0, 0, n - 1, pos + 1, n - 1, x, 1);
            }
            //printf("%d %d\n", r[i], T.get(0, 0, n - 1, 1));
            ++i;
        }
        int pos = lower_bound(all(a), z[j].Y) - a.begin();
        int ans = T.get(0, 0, n - 1, pos);
        if (i & 1)
        {
            //from A
            ans = max(0, ans - (z[j].X - r[i - 1]));
        }
        else
        {
            //to A
            ans = min(x, ans + (z[j].X - r[i - 1]));
        }
        printf("%d\n", ans);
        ++j;
    }
    return 0;
}

Measured memory_bytes: 12280