#include <bits/stdc++.h>
using namespace std;
long long const inf = 1e9;
long long const mod = 1e9 + 7;
int main() {
  long long x;
  cin >> x;
  int k;
  cin >> k;
  long long a[k];
  for (int i = (0); i < (k); i++) cin >> a[i];
  int q;
  cin >> q;
  while (q--) {
    long long t, ai;
    cin >> t >> ai;
    int m = -1;
    for (int b = (k + 1) / 2; b >= 1; b /= 2) {
      while (m + b < k && a[m + b] < t) m += b;
    }
    if (m == -1) {
      cout << max(0LL, ai - t) << endl;
    } else {
      if (m % 2 == 0) {
        cout << t - a[m] << endl;
      } else {
        cout << x - (t - a[m]) << endl;
      }
    }
  }
  return 0;
}
