#include <bits/stdc++.h>
int main(void) {
  int X, K;
  int *r;
  int Q;
  int *t;
  int *a;
  int *stock;
  char s[100000], w[10];
  char s2[] = " ";
  char *tok;
  int gram, timer;
  int maxt = 0;
  int reverser = -1;
  int i, j, k;
  scanf("%d", &X);
  scanf("%d", &K);
  r = new int[K];
  for (i = 0; i < K; i++) std::cin >> r[i];
  scanf("%d", &Q);
  t = new int[Q];
  a = new int[Q];
  stock = new int[Q];
  for (i = 0; i < Q; i++) {
    scanf("%d %d", &t[i], &a[i]);
    if (t[i] > maxt) maxt = t[i];
  }
  j = 0;
  for (i = 0; i < Q; i++) {
    if (0 == t[i]) stock[i] = a[i];
  }
  for (timer = 1; timer <= maxt; timer++) {
    for (i = 0; i < Q; i++) {
      a[i] += reverser;
      if (a[i] < 0 || a[i] > X) a[i] -= reverser;
      if (timer == t[i]) stock[i] = a[i];
    }
    if (timer == r[j]) {
      reverser *= -1;
      j++;
    }
  }
  for (i = 0; i < Q; i++) {
    printf("%d\n", stock[i]);
  }
  return 0;
}
