#include <bits/stdc++.h>
using namespace std;
const int dx[9] = {0, 1, -1, 0, 0, -1, -1, 1, 1};
const int dy[9] = {0, 0, 0, -1, 1, -1, 1, -1, 1};
const double pi = acos(-1.0);
const int N = 2e5;
struct abc {
  int t, a, id;
  bool operator<(const abc& tmp) const { return t < tmp.t; }
};
int X, K, n, ans[N + 10];
abc q[N + 10];
int main() {
  scanf("%d", &X), scanf("%d", &K);
  for (int i = 1; i <= K; i++) {
    int x;
    scanf("%d", &x);
    q[++n].t = x;
  }
  scanf("%d", &K);
  for (int i = 1; i <= K; i++) {
    int t, a;
    scanf("%d", &t), scanf("%d", &a);
    q[++n].t = t, q[n].a = a, q[n].id = i;
  }
  sort(q + 1, q + 1 + n);
  int a = 0, b = X, l = 0, r = X, pre = 0, sign = -1;
  for (int i = 1; i <= n; i++)
    if (q[i].id) {
      int rest = q[i].t - pre, temp;
      if (q[i].a <= l) {
        temp = a;
      } else if (q[i].a >= r) {
        temp = b;
      } else
        temp = a + q[i].a - l;
      temp += sign * rest;
      if (temp > X) temp = X;
      if (temp < 0) temp = 0;
      ans[q[i].id] = temp;
    } else {
      int v = q[i].t - pre;
      if (sign == -1) {
        if (a < v) {
          a = 0;
          b = max(b - v, 0);
          l = min(l + (v - a), X);
          r = max(l, r);
        } else {
          a -= v, b -= v;
        }
      } else {
        if (b + v <= X) {
          a += v, b += v;
        } else {
          a = min(a + v, X);
          r = max(r - (b + v - X), 0);
          l = min(l, r);
          b = X;
        }
      }
      pre = q[i].t;
      sign = sign * (-1);
    }
  for (int i = 1; i <= K; i++) printf("%d", ans[i]), puts("");
  return 0;
}
