#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() )
#define int long long

using namespace std;

const int N = 1e5 + 5, inf = 1e18;

struct st
{
    int m, s, mn;
    st()
    {
        m = 1;
        s = 0;
        mn = inf;
    }
};

st t[N * 4];

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

vector <pair <int, int> > V;

vector <pair <int, int> > vec;
vector <pair <int, pair <int, int> > >   M[N];

void build (int v = 1, int tl = 1, int tr = q)
{
    if (tl == tr)
        t[v].mn  = V[tl - 1].fr, mp[ V[tl - 1].sc ] = tl;
    else
    {
        int tm = (tl + tr) >> 1;

        build(v + v, tl, tm);
        build(v + v + 1, tm + 1, tr);

        t[v].mn = t[v + v].mn;
    }
}
void push (int v, int tl, int tr)
{
    t[v].mn = t[v].mn * t[v].m + t[v].s;

    if (tl != tr)
    {
        t[v + v].m *= t[v].m;
        t[v + v].s = t[v + v].s * t[v].m + t[v].s;

        t[v + v + 1].m *= t[v].m;
        t[v + v + 1].s = t[v + v + 1].s * t[v].m + t[v].s;
    }
    t[v].m = 1;
    t[v].s = 0;
}
int get_pos(int val, int v = 1, int tl = 1, int tr = q)
{
    push(v, tl, tr);

    if (t[v].mn >= val) return 0;

    if ( tl == tr )
        return tl;

    int tm = (tl + tr) >> 1;

    push(v + v, tl, tm);
    push(v + v + 1, tm + 1, tr);

    if (t[v + v + 1].mn < val)
        return get_pos( val, v + v + 1, tm + 1, tr );

    return get_pos( val, v + v , tl, tm );

}
void update (int l, int r, int m, int s, int v = 1, int tl = 1, int tr = q)
{
    push (v, tl, tr);

    if (l > r || tl > r || l > tr) return;

    if (l <= tl && tr <= r)
    {
        t[v].s = s;
        t[v].m = m;
        push (v, tl, tr);
        return;
    }
    int tm = (tl + tr) >> 1;

    update(l, r, m, s, v + v, tl, tm);
    update(l, r, m, s, v + v + 1, tm + 1, tr);

    t[v].mn = t[v + v].mn;
}
int get (int pos, int v = 1, int tl = 1, int tr = q)
{
    push(v, tl, tr);

    if (tl == tr)
        return t[v].mn;

    int tm = (tl + tr) >> 1;

    if (pos <= tm)
        return get(pos, v + v, tl, tm);

    return get(pos, v + v + 1, tm + 1, tr);
}
main ()
{
    cin >> x >> n;
    for (int i = 1; i <= n; i++)
    {
        scanf("%lld" ,&ar[i]);
        vec.pb( mk( ar[i], ar[i] - ar[i - 1] ) );
    }
    cin >> q;
    for (int i = 1; i <= q; i++)
    {
        scanf("%lld%lld", &a, &b);

        int pos = upper_bound( all(vec), mk(a, -1ll) ) - vec.begin() - 1;

        if (pos < 0) ans[i] = max(0ll, b - a);

        else M[pos].pb( mk(i, mk(a, b) ) );

        V.pb( mk(b,i) );
    }
    sort( all(V) );

    build ();

    for (int i = 0; i < vec.size(); i++)
    {
        int val = vec[i].sc;

        if(i % 2 == 0)
        {
            int pos = get_pos( val );
            update( 1, pos, 0, 0);
            update( pos + 1, q, 1, -val);
        }
        else
        {
            int pos = get_pos(x - val);

            update(1, pos, 1, val);
            update(pos + 1, q, 0, x);
        }
        for (int j = 0; j < M[i].size(); j++)
        {
            ans[ M[i][j].fr ] = get( mp[ M[i][j].fr] );

            if (i % 2 == 0)
                ans[ M[i][j].fr ] += min( x - ans[ M[i][j].fr ], (M[i][j].sc.fr - vec[i].fr) );
            else
                ans[ M[i][j].fr ] -= min( ans[ M[i][j].fr ], (M[i][j].sc.fr - vec[i].fr) );
        }
    }
    for (int i = 1; i <= q; i++)
        printf("%lld\n", ans[i]);
}

Measured memory_bytes: 22896