#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int clamp(int mi, int val, int ma) {
  if (val <= mi) return mi;
  if (val >= ma) return ma;
  return val;
}
int main() {
  int X, K;
  cin >> X >> K;
  vector<tuple<int, int, int, int>> events;
  for (int i = 0; i < K; i++) {
    int R;
    cin >> R;
    events.emplace_back(R, 0, 0, 0);
  }
  int Q;
  cin >> Q;
  for (int i = 0; i < Q; i++) {
    int T, A;
    cin >> T >> A;
    events.emplace_back(T, 1, A, i);
  }
  vector<int> ans(Q);
  int left = 0, right = X, pos = 0, prev = 0, dir = -1;
  sort(begin(events), end(events));
  for (auto &tup : events) {
    int time, type, A, idx;
    tie(time, type, A, idx) = tup;
    if (type == 0 && dir == +1) {
      pos += time - prev;
      if (pos + right - left > X) right = left + X - pos;
      pos = min(pos, X);
      prev = time;
      dir *= -1;
    } else if (type == 0 && dir == -1) {
      pos -= time - prev;
      if (pos < 0) left = min(left - pos, right);
      pos = max(pos, 0);
      prev = time;
      dir *= -1;
    } else if (type == 1 && dir == +1) {
      A = clamp(left, A, right);
      ans[idx] = clamp(0, pos - left + A + time - prev, X);
    } else {
      A = clamp(left, A, right);
      ans[idx] = clamp(0, pos - left + A - time + prev, X);
    }
  }
  for (int a : ans) cout << a << '\n';
  return 0;
}
