#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 10;

#define mid ((l + r) >> 1)
#define lson (p << 1)
#define rson (p << 1 | 1)

struct Node {
  int t, a, i;
};

struct Nod {
  int eq, mx, add;
} tr[N * 4];

int X, K;
int Q;
int t[N], a[N];
int r[N];
vector <int> vv;
vector <Node> v;
int z;
int ans[N];

void go(int &x) {
  x = min(X, x);
  x = max(0, x);
}

void set_eq(int p, int x) {
  tr[p].eq = x;
  tr[p].mx = x;
  tr[p].add = 0;
}

void add(int p, int x) {
  tr[p].mx += x;
  if (tr[p].eq >= 0) tr[p].eq += x, tr[p].add = 0;
  else tr[p].add += x;
}

void push_down(int p, int l, int r) {
  if (tr[p].eq >= 0) {
    set_eq(lson, tr[p].eq);
    set_eq(rson, tr[p].eq);
    tr[p].eq = -1;
    return;
  }
  if (tr[p].add) {
    add(lson, tr[p].add);
    add(rson, tr[p].add);
    tr[p].add = 0;
  }
}

void push_up(int p, int l, int r) {
  tr[p].mx = max(tr[lson].mx, tr[rson].mx);
  tr[p].add = 0;
  tr[p].eq = -1;
}

void build(int p, int l, int r) {
  if (l == r) {
    tr[p].eq = vv[l];
    tr[p].add = 0;
    tr[p].mx = vv[l];
    return;
  }
  build(lson, l, mid);
  build(rson, mid + 1, r);
  push_up(p, l, r);
}

void update_eq(int p, int l, int r, int ll, int rr, int x) {
  if (ll > rr) return;
  if (ll <= l && rr >= r) {
    set_eq(p, x);
    return;
  }
  push_down(p, l, r);
  if (ll <= mid) update_eq(lson, l, mid, ll, rr, x);
  if (rr >= mid + 1) update_eq(rson, mid + 1, r, ll, rr, x);
  push_up(p, l, r);
}

void update(int p, int l, int r, int ll, int rr, int x) {
  if (ll > rr) return;
  if (ll <= l && rr >= r) {
    add(p, x);
    return;
  }
  push_down(p, l, r);
  if (ll <= mid)
    update(lson, l, mid, ll, rr, x);
  if (rr >= mid + 1)
    update(rson, mid + 1, r, ll, rr, x);
  push_up(p, l, r);
}

int query(int p, int l, int r, int x) {
  if (l == r) return tr[p].eq;
  push_down(p, l, r);
  if (x <= mid) return query(lson, l, mid, x);
  else return query(rson, mid + 1, r, x);
}

int lower_bound(int p, int l, int r, int x) {
  if (l == r) {
    if (tr[p].mx >= x) return l;
    else return l + 1;
  }
  push_down(p, l, r);
  if (tr[lson].mx >= x) {
    return lower_bound(lson, l, mid, x);
  } else {
    return lower_bound(rson, mid + 1, r, x);
  }
}

void run() {
  scanf("%d", &X);
  scanf("%d", &K);
  for (int i = 1; i <= K; ++i) {
    scanf("%d", r + i);
  }
  scanf("%d", &Q);
  for (int i = 1; i <= Q; ++i) {
    scanf("%d%d", t + i, a + i);
    vv.push_back(a[i]);
  }
  sort(vv.begin(), vv.end());
  vv.erase(unique(vv.begin(), vv.end()), vv.end());
  for (int i = 1; i <= Q; ++i) {
    a[i] = lower_bound(vv.begin(), vv.end(), a[i]) - vv.begin();
  }
  z = vv.size();
  build(1, 0, z - 1);
  for (int i = 1; i <= K; ++i) {
    v.push_back({r[i], -1, 0});
  }
  for (int i = 1; i <= Q; ++i) v.push_back({t[i], a[i], i});
  sort(v.begin(), v.end(), [](Node a, Node b) { return make_pair(a.t, a.a) < make_pair(b.t, b.a); });
  int steps = v.size();
  int d = -1;
  int nw = 0;
  for (int i = 0; i < steps; ++i) {
    int t = d * (v[i].t - nw);
    nw = v[i].t;
    if (t < 0) {
      int x = lower_bound(1, 0, z - 1, -t);
      //cout << i << " t : " << t << " x: " << x << endl;
      update(1, 0, z - 1, x, z - 1, t);
      update_eq(1, 0, z - 1, 0, x - 1, 0);
      /*
      cout << "hi :";
      for (int i = 1; i <= 1; ++i)
        cout << i << "," << query(1, 0, z - 1, i) << " ";
      cout << endl;*/
    } else if (t > 0) {
      int x = lower_bound(1, 0, z - 1, X - t);
      //cout << i << " t : " << t << " " << X - t << " x: " << x << endl;
      update(1, 0, z - 1, 0, x - 1, t);
      update_eq(1, 0, z - 1, x, z - 1, X);
      /*
      cout << "hi :";
      for (int i = 1; i <= 1; ++i)
        cout << i << "," << query(1, 0, z - 1, i) << " ";
      cout << endl;*/
    }
    if (v[i].a == -1) d *= -1;
    else {
      ans[v[i].i] = query(1, 0, z - 1, v[i].a);
    }
  }
  for (int i = 1; i <= Q; ++i) printf("%d\n", ans[i]);
}

int main() {
  run();
  return 0;
}


Measured memory_bytes: 11376