#include <bits/stdc++.h>
using namespace std;
struct QQ {
  int t;
  int a;
  int sx;
} QQ[100000 + 100];
int r[100000 + 100];
int min(int a, int b) { return a < b ? a : b; }
int main() {
  int X;
  int K;
  scanf("%d %d", &X, &K);
  for (int i = 0; i < K; i++) scanf("%d", &r[i]);
  int Q;
  scanf("%d", &Q);
  for (int i = 0; i < Q; i++) scanf("%d %d", &QQ[i].t, &QQ[i].a);
  int sum = 0;
  int now = 0;
  long long time = 0;
  for (int k = 0; k < K; k++) {
    int n_now = now;
    int td = r[k];
    r[k] -= time;
    time = td;
    while (n_now < Q) {
      if (QQ[n_now].t <= r[k]) {
        now++;
        int lodiao = min(QQ[n_now].a, QQ[n_now].t);
        int bulba = QQ[n_now].a - lodiao;
        if (k % 2 == 0)
          printf("%d\n", bulba);
        else
          printf("%d\n", X - bulba);
        sum++;
        if (sum == Q) break;
      } else {
        int lodiao = min(r[k], QQ[n_now].a);
        QQ[n_now].a = X - QQ[n_now].a + lodiao;
        QQ[n_now].t -= r[k];
      }
      n_now++;
    }
  }
  while (now < Q) {
    if (K % 2 == 1)
      printf("%d\n", QQ[now].a);
    else
      printf("%d\n", X - QQ[now].a);
    now++;
  }
  return 0;
}
