#include <bits/stdc++.h>

#define fr first
#define sc second
#define mk make_pair
#define pb push_back
#define int long long
#define OK puts("OK");
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()

using namespace std;

const int N = 1e5 + 10;
const int inf = 1e9 + 7;
const double P = 3.141592653589793238462643;

int a, q, x, k, r[N], t, cnt, mx = -inf, cnt2;

main()
{
    cin >> x >> k;
    for( int i = 1; i <= k; i++ )
    {
        cin >> r[i];
        if( i % 2 == 0 )
            cnt2++;
        else
            cnt ++;
    }
    for( int i = k; i > 0; i--)
    {
        r[i] -= r[i - 1];
    }
    cin >> q;
    while( q-- )
    {
        int i = 1;
        cin >> t >> a;
        while( t > 0 )
        {
            if( i % 2 != 0 )
            {
                if( a - min( r[i], t ) >= 0 )
                {
                    a -= min( r[i], t );
                    t -= min( r[i], t );
                }
                else
                {
                    a = 0;
                    t -= min( t, r[i] );
                }
            }
            else
            {
                if( x - a >= 0 )
                {
                    a += min( r[i], t );
                    t -= min( r[i], t );
                }
                else
                {
                    a = x;
                    t -= min( r[i], t );
                }
            }
            i ++;
        }
        cout << a << endl;
    }
}
