#include <iostream>
using namespace std;
int X, K;
int Time[100005];
int A[100005], B[100005], C[100005];
void Read()
{
    cin >> X >> K;
    for(int i = 1; i <= K; i++)
        cin >> Time[i];
}

void precalcABC()
{
    A[0] = -1;
    B[0] = X + 1;
    C[0] = 0;
    for(int i = 1; i <= K; i++)
    {
        int a = A[i - 1], b = B[i - 1], c = C[i - 1];
        A[i] = a;B[i] = b;C[i] = c;
        if(i % 2 == 1)
        {
            int nb = Time[i] - Time[i - 1];
            nb -= c;
            if(nb >= b)
            {
                A[i] = X;
                C[i] = -X;
                B[i] = X + 1;
                continue;
            }
            if(nb >= a)
            {
                A[i] = nb;
                C[i] = -nb;
                B[i] = b;
                continue;
            }
            else
                C[i] = c - (nb + c), A[i] = a, B[i] = b;
        }
        else
        {
            int nb = Time[i] - Time[i - 1];
            int nb2 = X - nb - c;
            if(nb2 <= a)
            {
                B[i] = 0;
                A[i] = -1;
                C[i] = X;
                continue;
            }
            if(nb2 <= b)
            {
                B[i] = nb2;
                C[i] = X - B[i];
                A[i] = a;
            }
            else
            {
                C[i] += nb;
                A[i] = a;
                B[i] = b;
            }
        }
    }
}

int binSearch(int time)
{
    int left = 0, right = K, mid, sol = 0;
    while(left <= right)
    {
        mid = (left + right) / 2;
        if(Time[mid] < time)
        {
            sol = mid;
            left = mid + 1;
        }
        else
            right = mid - 1;
    }
    return sol;
}

void Solve(int time, int x)
{
    int t = binSearch(time);
    if(time == 0)
    {
        cout << x << "\n";
        return;
    }
    int a = A[t], b = B[t], c = C[t], a2 = a, b2 = b, c2 = c;
    if(t % 2 == 0)
        {
            int nb = time - Time[t];
            nb -= c;
            if(nb >= b)
            {
                a2 = X;
                c2 = -X;
                b2 = X + 1;

            }
            else
            {
                if(nb >= a)
                {
                    a2 = nb;
                    c2 = -nb;
                    b2 = b;
                }
                else
                    c2 = c - (nb + c), a2 = a, b2 = b;
            }
        }
        else
        {
            int nb = time - Time[t];
            int nb2 = X - nb - c;
            if(nb2 <= a)
            {
                b2 = 0;
                a2 = -1;
                c2 = X;

            }
            else
            {
                if(nb2 <= b)
                {
                    b2 = nb2;
                    c2 = X - b2;
                    a2 = a;
                }
                else
                {
                    c2 += nb;
                    a2 = a;
                    b2 = b;
                }
            }


        }
    if(x < a2)
    {
        cout << a2 + c2 << "\n";
        return;
    }
    if(x < b2)
    {
        cout << x + c2 << "\n";
        return;
    }
    cout << b2 + c2 << "\n";
}
int main()
{
    Read();
    precalcABC();
    int Q;
    cin >> Q;
    for(int i = 1; i <= Q; i++)
    {
        int time, x;
        cin >> time >> x;
        Solve(time, x);
    }
    return 0;
}


Measured memory_bytes: 2816