#include <bits/stdc++.h>
using namespace std;
int getResult(vector<int>& rlist, int K, int t, int a, int X) {
  int sign = -1;
  int i = 0;
  int current = 0;
  while (current < t) {
    int dt = t - current;
    if (i < K) {
      dt = min(dt, rlist[i] - current);
      i++;
    }
    a += sign * dt;
    a = max(a, 0);
    a = min(a, X);
    current += dt;
    sign *= -1;
  }
  return a;
}
int main() {
  int X, K, Q;
  cin >> X;
  cin >> K;
  vector<int> rlist;
  for (int i = 0; i < K; i++) {
    int r;
    cin >> r;
    rlist.push_back(r);
  }
  cin >> Q;
  for (int i = 0; i < Q; i++) {
    int t, a;
    cin >> t >> a;
    cout << getResult(rlist, K, t, a, X) << endl;
  }
  return 0;
}
