#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const int N = 1e6 + 5;
int n, x, q, t[N];
int main() {
  cin >> x >> n;
  for (int i = 1; i <= n; i++) cin >> t[i];
  cin >> q;
  while (q--) {
    int time, a, b, ans = 0, pos = 0;
    cin >> time >> a;
    b = x - a;
    for (int i = 1; i <= n; i++) {
      if (t[i] <= time) {
        b += (t[i] - t[i - 1]);
        b = min(b, x);
        a -= (t[i] - t[i - 1]);
        a = max(a, 0);
        swap(a, b);
        pos = i;
      } else
        break;
    }
    b += (time - t[pos]);
    b = min(b, x);
    a -= (time - t[pos]);
    a = max(a, 0);
    if (pos % 2 == 0)
      cout << a << endl;
    else
      cout << b << endl;
  }
}
