#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<ll>::iterator sit;
typedef map<ll,ll>::iterator mit;
 
ll r[111111];
pair<ii,ii> func[111111]; //[l, r] => mn + l, < l mn, > r, mx
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll x; cin>>x;
	int n; cin>>n;
	vi V;
	V.pb(0);
	r[0]=0;
	for(int i=1;i<=n;i++)
	{
		cin>>r[i];
		V.pb(r[i]);
	}
	for(int i=n;i>=1;i--)
	{
		r[i]-=r[i-1];
	}
	func[0] = mp(mp(0,x),mp(0,x));
	for(int i = 1; i <= n; i++)
	{
		func[i]=func[i-1];
		if(i&1)
		{
			//-r[i]
			if(func[i].se.fi>=r[i])
			{
				func[i].se.fi-=r[i];
				func[i].se.se-=r[i];
			}
			else
			{
				func[i].fi.fi = min(func[i].fi.fi+r[i]-func[i].se.fi,x);
				func[i].fi.se = max(func[i].fi.se,func[i].fi.fi);
				func[i].se.se = max(0LL, func[i].se.se - r[i]);
				func[i].se.fi=0;
			}
		}
		else
		{
			//+r[i]
			if(func[i].se.se+r[i]<=x)
			{
				func[i].se.fi+=r[i];
				func[i].se.se+=r[i];
			}
			else
			{
				func[i].fi.se = max(0LL, func[i].fi.se - func[i].se.se + x - r[i]);
				func[i].fi.fi = min(func[i].fi.fi,func[i].fi.se);
				func[i].se.se = x;
				func[i].se.fi = min(x, func[i].se.fi + r[i]);
			}
		}
	}
	int q; cin>>q;
	while(q--)
	{
		ll t, v; cin>>t>>v;
		int z = upper_bound(V.begin(),V.end(),t) - V.begin();
		z--;
		//V[z] <= t
		ll l = func[z].fi.fi;
		ll r = func[z].fi.se;
		ll mn = func[z].se.fi;
		ll mx = func[z].se.se;
		ll cur = 0;
		if(v<l)
		{
			cur = mn;
		}
		else if(v>r)
		{
			cur = mx;
		}
		else
		{
			cur = mn + v - l;
		}
		t -= V[z];
		if(z&1) //add t
		{
			cur+=t;
			if(cur>x) cur=x;
		}
		else
		{
			cur-=t;
			if(cur<0) cur=0;
		}
		cout<<cur<<'\n';
	}