#include<bits/stdc++.h>
using namespace std;

struct Data {int al, ah, bl, bh;};

int main() {
  int X, K;
  cin >> X >> K;
  vector<int> r(K);
  for(auto& i: r) cin >> i;

  auto fix = [X](auto& p) {
    for(auto* i: {&p.al, &p.ah, &p.bl, &p.bh}) {
      *i = max(0, *i);
      *i = min(*i, X);
    }
  };

  vector<Data> P(K);
  P[0] = {r[0], X, 0, X-r[0]};
  fix(P[0]);
  for(auto i=1; i<K; ++i) {
    P[i] = P[i-1];
    auto d = r[i] - r[i-1];
    if(i&1) {
      P[i].bl += d;
      P[i].bh += d;
      if(X < P[i].bl) P[i].al = X;
      if(X < P[i].bh) P[i].ah -= P[i].bh - X;
    } else {
      P[i].bl -= d;
      P[i].bh -= d;
      if(P[i].bl < 0) P[i].al += -P[i].bl;
      if(P[i].bh < 0) P[i].ah = 0;
    }
    fix(P[i]);
    if(P[i].al >= P[i].ah) P[i].al = X, P[i].ah = 0;
  }

  int Q;
  cin >> Q;
  for(auto q=0; q<Q; ++q) {
    int t, a;
    cin >> t >> a;
    auto i = upper_bound(begin(r), end(r), t) - begin(r);
    if(i == 0) {
      cout << max(0, a - t) << endl;
    } else {
      auto p = P[i-1];
      auto d = t - r[i-1];
      if(i&1) {
        if(a <= p.al)      a = p.bl;
        else if(p.ah <= a) a = p.bh;
        else               a = a - p.al;
        cout << min(X, a + d) << endl;
      } else {
        if(a <= p.al)      a = p.bl;
        else if(p.ah <= a) a = p.bh;
        else               a = p.ah - a;
        cout << max(0, a - d) << endl;
      }
    }
  }
}
