#include <bits/stdc++.h>
using namespace std;
class glass {
 public:
  void print() { cout << A << endl; }
  void init(queue<long long> temp, int To, int AA) {
    A = AA;
    total = To;
    B = total - A;
    Turn_time = temp;
    A_up = true;
    cur_time = 0;
  }
  void turnover() { A_up = !A_up; }
  void run(long long t) {
    while (cur_time < t) {
      cur_time++;
      if (A_up) {
        if (A > 0) {
          A--;
          B++;
        }
      } else {
        if (B > 0) {
          B--;
          A++;
        }
      }
      if (cur_time == Turn_time.front()) {
        turnover();
        Turn_time.pop();
      }
    }
  }

 private:
  long long A, B, total, cur_time;
  queue<long long> Turn_time;
  bool A_up;
};
int main() {
  long long X, K, Q, t, a, tmp;
  queue<long long> temp;
  cin >> X >> K;
  while (K--) {
    cin >> tmp;
    temp.push(tmp);
  }
  glass sample;
  cin >> Q;
  while (Q--) {
    cin >> t >> a;
    sample.init(temp, X, a);
    sample.run(t);
    sample.print();
  }
  return 0;
}
