#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 5;
pair<pair<int, int>, int> q[MAXN];
int ans[MAXN];
int main() {
  int X, k;
  cin >> X >> k;
  for (int i = 1; i <= k; i++) {
    cin >> q[i].first.first;
    q[i].second = -1;
  }
  int Q;
  cin >> Q;
  for (int i = 1; i <= Q; i++) {
    cin >> q[k + i].first.first >> q[k + i].first.second;
    q[k + i].second = i;
  }
  sort(q + 1, q + k + Q + 1);
  int l = 0;
  int r = X;
  int a = 0;
  int b = X;
  int sign = -1;
  int prev = 0;
  for (int i = 1; i <= k + Q; i++) {
    if (q[i].second != -1) {
      int diff = q[i].first.first - prev;
      int res;
      if (q[i].first.second <= l) {
        res = a;
      } else if (q[i].first.second >= r) {
        res = b;
      } else {
        res = a + q[i].first.second - l;
        cout << 123 << " " << res << endl;
      }
      res += diff * sign;
      if (res > X) {
        res = X;
      }
      if (res < 0) {
        res = 0;
      }
      ans[q[i].second] = res;
    } else {
      int diff = q[i].first.first - prev;
      if (sign == -1) {
        if (a - diff < 0) {
          l = min(X, l + diff - a);
          a = 0;
          b -= diff;
          b = max(b, 0);
          r = max(l, r);
        } else {
          a -= diff;
          b -= diff;
        }
      } else {
        if (b + diff > X) {
          r = max(0, r - diff + X - b);
          a = min(X, a + diff);
          l = min(l, r);
          b = X;
        } else {
          a += diff;
          b += diff;
        }
      }
      sign *= -1;
      prev = q[i].first.first;
    }
  }
  for (int i = 1; i <= Q; i++) {
    cout << ans[i] << " ";
  }
}
