#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main() {
//	freopen("input.txt","r",stdin);
	ll x,k,b;
	vector<ll> r;
	cin >>x>>k;
	for(int i=0;i<k;i++){
		int b;
		cin >>b;
		r.push_back(b);
	}
	ll q,t,a,v=0;
	cin >> q;
	for(int i=0;i<q;i++){
		cin >> t >> a;
		a-= min(r[0],t);
		a = max(a,0);
		for(int w=0;w<r.size();w++){
			if(t < r[w]){
				cout << a << endl;
				break;
			}if(w==r.size()-1){
				if(w%2!=0){
					a = max(0,a-(t-r[w]));
				}else{
					a = max(0,a+(t-r[w]));
				}
				a = min(a,x);
				cout << a << endl;
			}
			if(w%2!=0){
				a = max(0,a-(min(t,r[w+1])-r[w]));
			}else{
				a = max(0,a+(min(t,r[w+1])-r[w]));
			}
			
			a = min(a,x);
		}
	}
}