#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class A, size_t N, class T>
void Fill(A (&a)[N], const T &v) {
  fill((T *)a, (T *)(a + N), v);
}
const long long int INF = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  int first, K;
  int r[100005];
  cin >> first >> K;
  for (int i = 0; i < (K); i++) cin >> r[i];
  int Q, t[100005], a[100005];
  cin >> Q;
  for (int i = 0; i < (Q); i++) cin >> t[i] >> a[i];
  set<pair<int, int> > st;
  for (int i = 0; i < (K); i++) st.emplace(r[i], -1);
  for (int i = 0; i < (Q); i++) st.emplace(t[i], i);
  vector<pair<int, int> > v;
  for (int i = 0; i < (Q); i++) v.emplace_back(a[i], i);
  sort((v).begin(), (v).end());
  vector<int> ans(Q);
  int cur = 0, bf = 0, dr = -1;
  int l[] = {0, 0, (int)v.size() - 1};
  for (auto p : st) {
    if (p.second < 0) {
      int d = (p.first - bf) * dr;
      while (l[dr + 1] >= 0 && l[dr + 1] < v.size() &&
             (v[l[dr + 1]].first < cur - d ||
              v[l[dr + 1]].first > cur + first - d)) {
        int i = v[l[dr + 1]].second;
        a[i] = min(cur + first - d, max(cur - d, v[l[dr + 1]].first));
        v[l[dr + 1]].first = a[i];
        l[dr + 1] += -dr;
        chmax(l[2], l[0]);
        chmin(l[0], l[2]);
      }
      cur -= d;
      dr *= -1;
      bf = p.first;
    } else {
      int d = (p.first - bf) * dr;
      ans[p.second] = min(cur + first - d, max(cur - d, a[p.second])) - cur + d;
    }
  }
  for (auto t : ans) cout << t << endl;
  return 0;
}
