#include <iostream>
#include <vector>
#include <deque>
#include <math.h>
#include <set>
#include <iomanip>
#include <time.h>
#include <list>
#include <stdio.h>
#include <queue>
#include <map>
#include <algorithm>
#include <assert.h>
#include <memory.h>

#define mk make_pair
#define sc second
#define fr first
#define pb emplace_back
#define all(s) s.begin(), s.end()
#define sz(s) ( (int)s.size() )

using namespace std;

const int N = 1e5 + 5;

int x, n, ar[N], q, a, b;

vector <pair <int, int> > vec;

main ()
{
    cin >> x >> n;
    for (int i = 1; i <= n; i++)
        scanf("%d", &ar[i]), vec.pb( mk( ar[i], ar[i] - ar[i - 1] ) );


    cin >> q;
    while (q--)
    {
        scanf("%d%d", &a, &b);
        int pos = upper_bound( all(vec), mk(a, 0) ) - vec.begin() - 1;

        if (pos >= 0)
        {
            for (int i = 0; i <= pos; i++)
            {
                if (i % 2 == 0)
                    b -= min( b, vec[i].sc );
                else
                    b += min( x - b, vec[i].sc );
            }
            if (pos & 1)
                b -= min( b, (a - vec[pos].fr) );
            else
                b += min( x - b, (a - vec[pos].fr) );
        }
        else
            b -= min(b, a);

        printf("%d\n", b);
    }
}
