#include <bits/stdc++.h>
using namespace std;
const int N = 500000;
const long long MOD = 1e9 + 7;
int x;
int n, q;
int r[N], t[N], a[N];
int A, B, C, T, U;
void go(int t) {
  if (U == 0)
    C -= t - T;
  else
    C += t - T;
  if (C < 0) A = max(A, -C);
  if (C > 0) B = min(B, x - C);
  T = t;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> x >> n;
  B = x;
  for (int i = 0; i < n; i++) {
    cin >> r[i];
  }
  cin >> q;
  for (int i = 0; i < n; i++) {
    cin >> t[i] >> a[i];
  }
  for (int i = 0, j = 0; i < n || j < q;) {
    int k = 0;
    if (i == n) k = 1;
    if (i < n && t[j] < r[i]) k = 1;
    if (k == 0) {
      go(r[i]);
      U ^= 1;
      i++;
    } else {
      go(t[j]);
      if (a[j] < A) cout << A + C << "\n";
      if (A <= a[j] && a[j] < B) cout << a[j] + C << "\n";
      if (B <= a[j]) cout << B + C << "\n";
      j++;
    }
  }
}
