#include <bits/stdc++.h>
using namespace std;
int main(void) {
  cin.sync_with_stdio(false);
  long long X, K, Q;
  cin >> X >> K;
  vector<long long> Rs(K);
  for (int k = 0; k < (int)(K); ++k) cin >> Rs[k];
  cin >> Q;
  ++K;
  Rs.push_back(1e9 + 1000);
  vector<tuple<long long, long long, int>> queries(Q);
  for (int q = 0; q < (int)(Q); ++q) {
    long long t, a;
    cin >> t >> a;
    queries[q] = make_tuple(t, a, q);
  }
  sort((queries).begin(), (queries).end());
  vector<long long> ans(Q);
  bool down = true;
  long long mx = X;
  long long mn = 0;
  long long offset = 0;
  long long prev_r = 0;
  int q_idx = 0;
  long long cont = true;
  for (int i = 0; i < (int)(K); ++i) {
    auto r = Rs[i];
    while (true) {
      auto t = get<0>(queries[q_idx]);
      auto a = get<1>(queries[q_idx]);
      auto q = get<2>(queries[q_idx]);
      if (t <= r) {
        a = min(a, mx);
        a = max(a, mn);
        a += offset;
        if (down) {
          a -= t - prev_r;
          a = max(a, 0LL);
        } else {
          a += t - prev_r;
          a = min(a, X);
        }
        ans[q] = a;
        ++q_idx;
        if (q_idx == Q) {
          cont = false;
          break;
        }
      } else {
        break;
      }
    }
    if (!cont) break;
    auto range = r - prev_r;
    auto mx_now = mx + offset;
    auto mn_now = mn + offset;
    if (down) {
      auto mx_after = max((mx + offset) - range, 0LL);
      offset = mx_after - mx;
      mn_now = max(0LL, mn - range);
      mn = max(mn, mn_now - offset);
    } else {
      auto mn_after = min((mn + offset) + range, X);
      offset = mn_after - mn;
      mx_now = min(X, mx + range);
      mx = min(mx, mx_now - offset);
    }
    down = !down;
    prev_r = r;
  }
  for (int q = 0; q < (int)(Q); ++q) {
    cout << ans[q] << endl;
  }
  return 0;
}
