#include <bits/stdc++.h>
using namespace std;
const int S = (1 << 20) + 5;
char buf[S], *H, *T;
inline char Get() {
  if (H == T) T = (H = buf) + fread(buf, 1, S, stdin);
  if (H == T) return -1;
  return *H++;
}
inline int read() {
  int x = 0;
  char c = Get();
  while (!isdigit(c)) c = Get();
  while (isdigit(c)) x = x * 10 + c - '0', c = Get();
  return x;
}
const int N = 100010;
int r[N];
int main() {
  int X = read(), n = read();
  for (int i = 1; i <= n; i++) r[i] = read();
  int Q = read();
  while (Q--) {
    int t = read(), a = read(), k = -1;
    for (int i = 1; i <= n; i++, k = -k) {
      int len = (r[i] <= t ? r[i] : t) - r[i - 1];
      a = (k == -1) ? max(0, a - len) : min(X, a + len);
      if (t <= r[i]) break;
    }
    if (t > r[n]) {
      int len = t - r[n];
      a = (k == -1) ? max(0, a - len) : min(X, a + len);
    }
    printf("%d\n", a);
  }
  return 0;
}
