#include <stdio.h>
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <set>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <map>
#include <queue>
#include <array>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef long double ld;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<pii> vii;
typedef vector<string> vs;
//typedef long long int;

int nx[100005][17];
int mi[100005][17];
int ma[100005][17];

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  int x, k, Q;
  cin >> x >> k;
  ++k;
  vi r(k+1), t(k), in(k+1), st(k);
  for (int i = 0; i < k-1; ++i) cin >> r[i+1];
  r[k] = 2e9;
  for (int i = 0; i < k; ++i) {
    t[i] = r[i+1] - r[i];
    st[i] = (i % 2 ? t[i] : -t[i]);
  }
  vi s(k + 1);
  for (int i = 0; i < k; ++i) {
    s[i+1] = s[i] + st[i];
  }
  for (int i = 0; i <= k; ++i) {
    in[i] = (i % 2 ? 0 : x);
  }
  for (int i = 0; i < k; ++i) {
    mi[i][0] = ma[i][0] = st[i];
  }
  for (int b = 1; b < 17; ++b) {
    int B = 1 << b;
    for (int i = 0; i + B < k; ++i) {
      int add = s[i+B/2] - s[i];
      mi[i][b] = min(mi[i][b-1], mi[i+B/2][b-1] + add);
      ma[i][b] = max(ma[i][b-1], ma[i+B/2][b-1] + add);
    }
  }
  nx[k-1][0] = nx[k][0] = k;
  for (int i = 0; i + 1 < k; ++i) {
    int cur = in[i], pos = i;
    for (int b = 16; b >= 0; --b) {
      int B = 1 << b;
      if (pos + B >= k || cur + mi[pos][b] < 0 || cur + ma[pos][b] > x) continue;
      cur += s[pos+B] - s[pos];
      pos += B;
    }
//    cerr << i << ' ' << pos << ' ' << cur << ' ' << st[pos] << endl;
    assert(cur + mi[pos][0] < 0 || cur + ma[pos][0] > x && max(0, min(x, cur + st[pos])) == in[pos+1]);
    nx[i][0] = pos + 1;
  }
  for (int b = 1; b < 17; ++b) {
    for (int i = 0; i <= k; ++i) {
      nx[i][b] = nx[nx[i][b-1]][b-1];
    }
  }
  cin >> Q;
  vector<array<int, 2>> q(Q);
  vi res(Q);
  //cerr << s[0] << ' ' << s[1] << endl;
  for (int i = 0; i < Q; ++i) {
    cin >> q[i][0] >> q[i][1];
    int cur = q[i][1], rem = q[i][0], pos = 0;
    //cerr << i << ' ' << pos << ' ' << cur << ' ' << rem << endl;
    for (int b = 16; b >= 0; --b) {
      int B = 1 << b;
      if (pos + B >= k || cur + mi[pos][b] < 0 || cur + ma[pos][b] > x || r[pos + B] - r[pos] > rem) continue;
      int time = r[pos + B] - r[pos];
      rem -= time;
      cur += s[pos+B] - s[pos];
      pos += B;
//      cerr << i << ' ' << pos << ' ' << cur << ' ' << rem << endl; 
    }
    if (rem <= t[pos]) {
      res[i] = cur + (pos % 2 ? rem : -rem);
      continue;
    }
    //cerr << i << ' ' << pos << ' ' << cur << ' ' << rem << endl;
    rem -= t[pos];
    cur = min(x, max(0, (cur + st[pos])));
    ++pos;
    assert(cur == in[pos]);
    for (int b = 16; b >= 0; --b) {
      int B = 1 << b;
      int npos = nx[pos][b];
      int time = r[npos] - r[pos];
      if (time > rem) continue;
//      cerr << pos << ' ' << npos << ' ' << b << endl;
      pos = npos;
      cur = in[pos];
      rem -= time;
    }
    //cerr << i << ' ' << pos << ' ' << cur << ' ' << rem << endl;
    for (int b = 16; b >= 0; --b) {
      int B = 1 << b;
      if (pos + B >= k || cur + mi[pos][b] < 0 || cur + ma[pos][b] > x || r[pos + B] - r[pos] > rem) continue;
      int time = r[pos + B] - r[pos];
      rem -= time;
      cur += s[pos+B] - s[pos];
      pos += B;
    }
    if (rem <= t[pos]) {
      res[i] = cur + (pos % 2 ? rem : -rem);
      continue;
    }
    //cerr << i << ' ' << pos << ' ' << cur << ' ' << rem << endl;
    assert(0);
  }
  for (int i = 0; i < Q; ++i) {
    cout << min(x, max(0, res[i])) << endl;
  }
  return 0;
}

Measured memory_bytes: 24320