#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFF = 0x3f3f3f3f3f3f3f3fll;
const int MAX = 1e5 + 5;
const int MAX_N = MAX;
const long long MOD = 998244353;
const long double pi = acos(-1.0);
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template <typename T>
inline T abs(T a) {
  return a > 0 ? a : -a;
}
template <class T>
inline void read(T& num) {
  bool start = false, neg = false;
  char c;
  num = 0;
  while ((c = getchar()) != EOF) {
    if (c == '-')
      start = neg = true;
    else if (c >= '0' && c <= '9') {
      start = true;
      num = num * 10 + c - '0';
    } else if (start)
      break;
  }
  if (neg) num = -num;
}
inline long long powMM(long long a, long long b, long long M) {
  long long ret = 1;
  a %= M;
  while (b) {
    if (b & 1) ret = ret * a % M;
    b >>= 1;
    a = a * a % M;
  }
  return ret;
}
void open() {
  freopen("1009.in", "r", stdin);
  freopen("out.txt", "w", stdout);
}
int a[MAX], b[MAX], c[MAX], r[MAX];
int x, k, dis, t, st;
int q;
int gps(int x) {
  int l = 1, ri = k, mid, an = 0;
  while (l <= ri) {
    mid = (l + ri) >> 1;
    if (r[mid] > x)
      ri = mid - 1;
    else
      an = mid, l = mid + 1;
  }
  return an;
}
int main() {
  scanf("%d%d", &x, &k);
  for (int i = 1; i <= k; i++) scanf("%d", &r[i]);
  a[0] = 0;
  b[0] = x;
  c[0] = 0;
  for (int i = 1; i <= k; i++) {
    dis = r[i] - r[i - 1];
    t = st % 2 ? max(0, x - dis) : min(x, dis);
    if (st % 2) {
      if (t >= b[i - 1] + c[i - 1]) {
        c[i] = c[i - 1] + dis;
        a[i] = a[i - 1];
        b[i] = b[i - 1];
      } else if (t > a[i - 1] + c[i - 1] && t < b[i - 1] + c[i - 1]) {
        int tem = t - c[i - 1];
        b[i] = tem;
        a[i] = a[i - 1];
        c[i] = c[i - 1] + dis;
      } else
        a[i] = b[i] = x, c[i] = 0;
    } else {
      if (t <= a[i - 1] + c[i - 1]) {
        c[i] = c[i - 1] - dis;
        a[i] = a[i - 1];
        b[i] = b[i - 1];
      } else if (t > a[i - 1] + c[i - 1] && t < b[i - 1] + c[i - 1]) {
        int tem = t - c[i - 1];
        a[i] = tem;
        b[i] = b[i - 1];
        c[i] = c[i - 1] - dis;
      } else
        a[i] = b[i] = c[i] = 0;
    }
    st ^= 1;
  }
  scanf("%d", &q);
  while (q--) {
    int temt, tema;
    scanf("%d%d", &temt, &tema);
    int id = gps(temt);
    int dir = (id & 1) ^ 1, an;
    if (tema <= a[id])
      an = a[id] + c[id] + (dir ? -1 : 1) * (temt - r[id]);
    else if (tema <= b[id])
      an = c[id] + tema + (dir ? -1 : 1) * (temt - r[id]);
    else
      an = b[id] + c[id] + (dir ? -1 : 1) * (temt - r[id]);
    an = min(an, x);
    an = max(an, 0);
    printf("%d\n", an);
  }
  return 0;
}
