#include <bits/stdc++.h>
using namespace std;
vector<long long> d;
int main() {
  long long X;
  cin >> X;
  int K;
  cin >> K;
  vector<long long> r(K + 1);
  for (int i = (0); i < (K); ++i) cin >> r[i];
  r[K] = 1e15;
  int Q;
  cin >> Q;
  d.resize(K + 1);
  vector<int> idx(K + 1);
  for (int i = (0); i < (K + 1); ++i) idx[i] = i;
  d[0] = 0;
  for (int i = (1); i < (K + 1); ++i) {
    d[i] = d[i];
    if (i % 2 == 0)
      d[i] += r[i - 1];
    else
      d[i] -= r[i - 1];
    d[i] = max(-X, min(d[i], X));
  }
  sort(idx.begin(), idx.end(), [](int i, int j) { return d[i] < d[j]; });
  vector<long long> D(K + 1);
  for (int i = (0); i < (K + 1); ++i) D[i] = d[i];
  sort(D.begin(), D.end());
  for (int i = (0); i < (Q); ++i) {
    long long t, a;
    cin >> t >> a;
    long long tmax = 1e15, tmin = 1e15;
    if (a + d[0] < 0) tmin = lower_bound(D.begin(), D.end(), -a) - D.begin();
    if (X > a + d[K - 1])
      tmax = lower_bound(D.begin(), D.end(), X - a) - D.begin();
    if (tmax == 1e15 && tmin == 1e15) {
      int ti = upper_bound(r.begin(), r.end(), t) - r.begin();
      ti--;
      a += d[ti];
      if (ti % 2 == 1)
        a -= t - r[ti];
      else
        a += t - r[ti];
    } else if (idx[tmin] < idx[tmax]) {
      a = 0;
      int ti = upper_bound(r.begin(), r.end(), t) - r.begin();
      ti--;
      a = d[ti] - d[idx[tmax]];
      if (ti % 2 == 1)
        a -= t - r[ti];
      else
        a += t - r[ti];
    } else {
      a = X;
      int ti = upper_bound(r.begin(), r.end(), t) - r.begin();
      ti--;
      a = d[ti] - d[idx[tmax]];
      if (ti % 2 == 1)
        a -= t - r[ti];
      else
        a += t - r[ti];
    }
    cout << a << '\n';
  }
  return 0;
}
