#include <bits/stdc++.h>
using namespace std;
int read() {
  char c = getchar();
  int d = 0, f = 1;
  for (; c < '0' || c > '9'; c = getchar())
    if (c == '-') f = -1;
  for (; c >= '0' && c <= '9'; d = d * 10 + c - 48, c = getchar())
    ;
  return d * f;
}
const int N = 100002;
const long long inf = 1e15;
long long r[N], t[N * 2], f0[N][17], f1[N][17];
int X, n, q, a[N], f[N * 2][17];
int main() {
  X = read();
  n = read();
  for (int i = 1; i <= n; ++i) {
    t[i + n + 1] = t[i] = read();
    int s = t[i] - t[i - 1];
    r[i] = (i & 1) ? (r[i - 1] - s) : (r[i - 1] + s);
  }
  ++n;
  r[n] = (n & 1) ? (r[n - 1] - long long(1e10)) : (r[n - 1] + long long(1e10));
  t[n + n] = t[n] = t[n - 1] + long long(1e10);
  for (int i = n; i >= 1; --i) {
    f0[i][0] = f1[i][0] = r[i];
    for (int j = 0; j <= 15; ++j) {
      int J = i + (1 << j);
      long long s0 = J <= n ? f0[J][j] : inf;
      long long s1 = J <= n ? f1[J][j] : -inf;
      f0[i][j + 1] = min(f0[i][j], s0);
      f1[i][j + 1] = max(f1[i][j], s1);
    }
    int s1 = i + 1, s2 = i + 1, s3 = i + 1, s4 = i + 1;
    for (int j = 16; j >= 0; --j) {
      if ((s1 + (1 << j) - 1 <= n) && f1[s1][j] - r[i] < X) s1 += (1 << j);
      if ((s2 + (1 << j) - 1 <= n) && f1[s2][j] - r[i] < 0) s2 += (1 << j);
      if ((s3 + (1 << j) - 1 <= n) && f0[s3][j] - r[i] > 0) s3 += (1 << j);
      if ((s4 + (1 << j) - 1 <= n) && f0[s4][j] - r[i] > -X) s4 += (1 << j);
    }
    if (s1 <= n) f[i][0] = s1 + n;
    if (s2 <= n) f[i + n][0] = s2 + n;
    if (s3 <= n) f[i][0] = s3;
    if (s4 <= n) f[i + n][0] = s4;
    for (int j = 0; j <= 15; ++j) {
      f[i][j + 1] = f[f[i][j]][j];
      f[i + n][j + 1] = f[f[i + n][j]][j];
    }
  }
  q = read();
  for (int i = 1; i <= q; ++i) {
    int t_ = read(), s = read();
    int s1 = 1, s2 = 1, S;
    for (int j = 16; j >= 0; --j) {
      if ((s1 + (1 << j) - 1 <= n) && s + f1[s1][j] < X) s1 += (1 << j);
      if ((s2 + (1 << j) - 1 <= n) && s + f0[s2][j] > 0) s2 += (1 << j);
    }
    S = min(s1, s2);
    int pos = 0;
    for (int j = 16; j >= 0; --j)
      if (pos + (1 << j) <= n && t[pos + (1 << j)] <= t_) pos += (1 << j);
    if (pos <= S) {
      t_ -= t[pos];
      long long ans = s + r[pos];
      if (ans < 0) ans = 0;
      if (ans > X) ans = X;
      if ((pos + 1) & 1)
        ans -= t_;
      else
        ans += t_;
      if (ans < 0) ans = 0;
      if (ans > X) ans = X;
      printf("%lld\n", ans);
      continue;
    }
    if (S == s1) S += n;
    for (int j = 16; j >= 0; --j)
      if (f[S][j] && t[f[S][j]] <= t_) S = f[S][j];
    long long ans = 0;
    if (S > n) ans = X, S -= n;
    ans += r[pos] - r[S];
    t_ -= t[pos];
    if (ans < 0) ans = 0;
    if (ans > X) ans = X;
    if ((pos + 1) & 1)
      ans -= t_;
    else
      ans += t_;
    if (ans < 0) ans = 0;
    if (ans > X) ans = X;
    printf("%lld\n", ans);
  }
}
