#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;
  for (int i = 0; i < Q; ++i) {
    int t, a;
    cin >> t >> a;
    bool up = true;
    int current = a;
    int prev = 0;
    for (int j = 0; j < r.size(); ++j) {
      if (r[j] >= t) break;
      current -= r[j] - prev;
      if (current < 0) current = 0;
      current = X - current;
      prev = r[j];
      up = not up;
    }
    current -= t - prev;
    if (current < 0) current = 0;
    cout << (up ? current : X - current) << endl;
  }
  return 0;
}
