#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int r[MAXN];
int x, k;
void read() {
  scanf("%d%d", &x, &k);
  for (int i = 0; i < k; ++i) scanf("%d", r + i);
  for (int i = k - 1; i > 0; --i) r[i] -= r[i - 1];
}
void solve(int t, int a) {
  int b = x - a;
  for (int i = 0; i < k; ++i) {
    if (t >= r[i]) {
      if (i & 1) {
        a += min(b, r[i]);
        b -= min(b, r[i]);
      } else {
        b += min(a, r[i]);
        a -= min(a, r[i]);
      }
      t -= r[i];
      continue;
    }
    if (i & 1) {
      a += min(b, t);
      b -= min(b, t);
    } else {
      b += min(a, t);
      a -= min(a, t);
    }
    t = 0;
    break;
  }
  if (t) {
    if (k & 1) {
      a += min(b, t);
      b -= min(b, t);
    } else {
      b += min(a, t);
      a -= min(a, t);
    }
  }
  printf("%d\n", a);
}
void work() {
  int q;
  scanf("%d", &q);
  for (int i = 0; i < q; ++i) {
    int ti, ai;
    scanf("%d%d", &ti, &ai);
    solve(ti, ai);
  }
}
int main() {
  read();
  work();
  return 0;
}
