#include <bits/stdc++.h>
using namespace std;
int main() {
  int X, K;
  cin >> X >> K;
  vector<int> r(K, 0);
  for (int i = 0; i < K; ++i) cin >> r[i];
  int Q;
  cin >> Q;
  vector<int> t(Q, 0), a(Q, 0);
  for (int i = Q; i != 0;) {
    --i;
    cin >> t[i] >> a[i];
  }
  bool up = true;
  int prev = 0;
  vector<int> current = a;
  vector<int> answers;
  for (int i = 0; i < r.size(); ++i) {
    for (int j = t.size(); j != 0;) {
      --j;
      if (t[j] <= r[i]) {
        current[j] -= t[j] - prev;
        if (current[j] < 0) current[j] = 0;
        answers.push_back(up ? current[j] : X - current[j]);
        t.pop_back();
      } else {
        current[j] -= r[i] - prev;
        if (current[j] < 0) current[j] = 0;
        current[j] = X - current[j];
      }
    }
    prev = r[i];
    up = not up;
  }
  for (int j = t.size(); j != 0;) {
    --j;
    current[j] -= t[j] - prev;
    if (current[j] < 0) current[j] = 0;
    answers.push_back(up ? current[j] : X - current[j]);
  }
  for (auto answer : answers) cout << answer << endl;
  return 0;
}
