#include <bits/stdc++.h>
using namespace std;
int x, k, r[100005], t, num;
inline int read() {
  int x = 0;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x;
}
int main() {
  int i, j, q;
  x = read();
  k = read();
  for (i = 1; i <= k; i++) {
    r[i] = read();
  }
  q = read();
  for (i = 1; i <= q; i++) {
    t = read();
    num = read();
    int pos = k;
    for (j = 1; j <= k; j++) {
      if (r[j] >= t) {
        pos = j - 1;
        break;
      }
      num -= (r[j] - r[j - 1]);
      num = (num < 0 ? 0 : num);
      num = x - num;
    }
    num -= (t - r[pos]);
    num = (num < 0 ? 0 : num);
    if (pos & 1) {
      num = x - num;
    }
    printf("%d\n", num);
  }
  return 0;
}
