#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long x, k;
  vector<long long> r;
  cin >> x >> k;
  vector<pair<long long, long long> > ev;
  for (long long i = 0; i < k; i++) {
    long long tmp;
    cin >> tmp;
    r.push_back(tmp);
    ev.push_back(make_pair(tmp, -1));
  }
  long long q;
  cin >> q;
  for (long long i = 0; i < q; i++) {
    long long tim, a;
    cin >> tim >> a;
    ev.push_back(make_pair(tim, a));
  }
  sort(ev.begin(), ev.end());
  vector<long long> ans;
  long long dir = -1, con = 0, ct = 0, btm = 0, tp = x;
  for (long long i = 0; i < ev.size(); i++) {
    long long et = ev[i].first - ct;
    btm = min(max(btm, -con), x - con);
    tp = min(max(tp, -con), x - con);
    if (ev[i].second == -1) {
      dir *= -1;
    } else {
      long long a = ev[i].second;
      a = min(max(btm, a), tp);
      ans.push_back(a + con);
    }
    ct = ev[i].first;
  }
  for (long long i = 0; i < ans.size(); i++) {
    cout << ans[i] << endl;
  }
}
