#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int X, K, Q, r[N], t[N], x[N], a, b, c, t1, t2, add, tmp, diff, f;
int main() {
  cin >> X;
  cin >> K;
  for (int i = 1; i <= K; i++) cin >> r[i];
  cin >> Q;
  for (int i = 1; i <= Q; i++) cin >> t[i] >> x[i];
  t1 = 0, t2 = 1;
  a = 0, b = X, c = 0, f = -1;
  while (t2 <= Q) {
    if (t[t2] > r[t1 + 1] && t1 < K) {
      t1++;
      add = r[t1] - r[t1 - 1];
      b = min(b, min(X, X - f * add) - c);
      a = max(a, max(0, 0 - f * add) - c);
      c = max(-X, min(X, c + f * add));
      f *= -1;
    } else {
      if (x[t2] < a)
        tmp = a + c;
      else if (x[t2] > b)
        tmp = b + c;
      else
        tmp = x[t2] + c;
      diff = t[t2] - r[t1];
      tmp = max(0, min(X, tmp + diff * f));
      cout << tmp << endl;
      t2++;
    }
  }
  return 0;
}
