#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
template <typename T, typename T2>
inline void _max(T &a, T2 b) {
  a = max((T)a, (T)b);
}
template <typename T, typename T2>
inline void _min(T &a, T2 b) {
  a = min((T)a, (T)b);
}
const int MAX = 1e5 + 10;
int x, k, r[MAX];
pair<int, int> los[MAX], his[MAX];
void clear() {}
void read() {
  scanf("%d", &k);
  r[0] = 0;
  for (int i = 1; i <= k; i++) scanf("%d", &r[i]);
  sort(r, r + k);
}
template <typename T>
T binSearch(T l, T r, function<bool(T)> f, bool take_right = false) {
  while (l <= r) {
    T mid = (l + r) / 2;
    bool res = f(mid);
    if (res)
      r = mid - 1;
    else
      l = mid + 1;
  }
  return take_right ? l : r;
}
void solve() {
  los[0] = {0, 0}, his[0] = {x, x};
  for (int i = 1; i <= k; i++) {
    int d = r[i] - r[i - 1];
    auto l = los[i - 1].first + (i & 1 ? -d : d);
    auto h = his[i - 1].first + (i & 1 ? -d : d);
    int fl = los[i].second, fh = his[i - 1].second;
    if (l < 0) {
      fl = min(x, fl - l);
      l = 0;
    }
    if (h < 0) {
      fh = min(x, fh - l);
      h = 0;
    }
    if (l > x) {
      fl = max(0, fl - l);
      l = x;
    }
    if (h > x) {
      fh = max(0, fh - l);
      h = x;
    }
    los[i] = {l, fl}, his[i] = {h, fh};
  }
  int nq;
  scanf("%d", &nq);
  while (nq--) {
    int t, a;
    scanf("%d%d", &t, &a);
    int i = binSearch<int>(0, k, [&](int i) -> bool { return r[i] > t; });
    int d = t - r[i], ta;
    if (a <= los[i].second)
      ta = 0;
    else if (a >= his[i].second)
      ta = x;
    else
      ta = los[i].first + a - los[i].second;
    int res = ta + (i & 1 ? d : -d);
    res = max(0, res);
    res = min(x, res);
    printf("%d\n", res);
  }
}
int main() {
  while (scanf("%d", &x) == 1) {
    clear();
    read();
    solve();
    return 0;
  }
  return 0;
}
