#include <bits/stdc++.h>
using namespace std;
const int maxK = 100001;
int main() {
  int X, K;
  cin >> X >> K;
  int turn[maxK];
  for (int i = 0; i < K; i++) cin >> turn[i];
  for (int i = K - 1; i >= 1; i--) turn[i] -= turn[i - 1];
  int Q;
  cin >> Q;
  while (Q--) {
    int T, init;
    bool Aup = true;
    cin >> T >> init;
    int turnnum = 0;
    while (T > 0) {
      int sub = min(T, turn[turnnum]);
      if (Aup) {
        init -= sub;
        init = max(0, init);
      } else {
        init += sub;
        init = min(X, init);
      }
      T -= turn[turnnum++];
      Aup = !Aup;
    }
    cout << init << '\n';
  }
  return 0;
}
