#include <bits/stdc++.h>
using namespace std;
int main() {
  int X, K;
  cin >> X >> K;
  vector<int> r(K + 2);
  r[0] = 0;
  for (int i = 1; i < K + 1; i++) cin >> r[i];
  int Q;
  cin >> Q;
  vector<int> t(Q), a(Q);
  for (int i = 0; i < Q; i++) cin >> t[i] >> a[i];
  r[K + 1] = t[Q - 1];
  vector<bool> used(Q, false);
  for (int i = 1; i < K + 2; i++) {
    for (int j = 0; j < Q; j++) {
      if (used[j]) continue;
      if (t[j] <= r[i]) {
        cout << ((i % 2 == 1) ? max(0, a[j] - (t[j] - r[i - 1]))
                              : min(X, a[j] + (t[j] - r[i - 1])))
             << endl;
        used[j] = true;
      } else {
        if (i % 2 == 1) {
          a[j] = max(0, a[j] - (r[i] - r[i - 1]));
        } else {
          a[j] = min(X, a[j] + (r[i] - r[i - 1]));
        }
      }
    }
  }
}
