#include <bits/stdc++.h>
using namespace std;
struct Rec {
  long t;
  long ub;
  long lb;
  long offset;
};
constexpr long END = 1000000000;
int main() {
  long X;
  cin >> X;
  int K;
  cin >> K;
  vector<long> R(K);
  for (long& r : R) cin >> r;
  if (R.back() != END) R.push_back(END);
  vector<Rec> recs;
  long dir = -1;
  recs.push_back({0, X, 0, 0});
  for (long r : R) {
    const Rec& last = recs.back();
    long nub = last.ub;
    long nlb = last.lb;
    long noff = last.offset + dir * (r - last.t);
    if (noff < 0) {
      nlb = max(-noff, nlb);
    } else {
      nub = min(X - noff, nub);
    }
    recs.push_back({r, nub, nlb, noff});
    dir = -dir;
  }
  int Q;
  cin >> Q;
  vector<pair<long, long>> Qs(Q);
  for (auto& q : Qs) {
    cin >> q.first >> q.second;
  }
  for (int i = 0; i < Q; ++i) {
    long t = Qs[i].first;
    long a = Qs[i].second;
    vector<Rec>::const_iterator rb, re;
    tie(rb, re) =
        equal_range(recs.begin(), recs.end(), Rec{t, 0, 0, 0},
                    [](const Rec& x, const Rec& y) { return x.t < y.t; });
    if (rb != re) {
      assert(rb->t == t);
      long ans = a + rb->offset;
      if (a < rb->lb) {
        ans = rb->lb + rb->offset;
      } else if (a > rb->ub) {
        ans = rb->ub + rb->offset;
      }
      cout << ans << '\n';
      continue;
    }
    assert(rb != recs.begin());
    --rb;
    assert(rb != recs.end());
    long dir = rb->offset < re->offset ? 1 : -1;
    long rt = t - rb->t;
    long ans = -1;
    if (a < rb->lb) {
      ans = rb->lb + rb->offset + dir * rt;
    } else if (a > rb->ub) {
      ans = rb->ub + rb->offset + dir * rt;
    } else {
      ans = a + rb->offset + dir * rt;
    }
    if (ans > X) ans = X;
    if (ans < 0) ans = 0;
    cout << ans << '\n';
  }
  return 0;
}
