/*
#include <bits/stdc++.h>
using namespace std;
const int N = 1234567;
int r[N], t[N], init[N];

int main() {
  int x, n;
  scanf("%d %d", &x, &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", r + i);
  }
  int tt;
  scanf("%d", &tt);
  for (int i = 0; i < tt; i++) {
    scanf("%d %d", t + i, init + i);
  }
  int a = 0;
  int val_a = 0;
  int b = x;
  int val_b = x;
  int dir = -1;
  int out = -1;
  int ptr = 0;
  for (int i = 0; i <= n; i++) {
    while (ptr < tt && (i == n || t[ptr] <= r[i])) {
      int now = -1;
      if (init[ptr] <= a) {
        now = val_a;
      } else {
        if (init[ptr] >= b) {
          now = val_b;
        } else {
          now = val_a - out * (init[ptr] - a);
        }
      }
      now += (t[ptr] - (i == 0 ? 0 : r[i - 1])) * dir;
      now = max(now, 0);
      now = min(now, x);
      printf("%d\n", out == -1 ? now : x - now);
      ptr++;
    }
    if (i < n) {
      int pass = r[i] - (i == 0 ? 0 : r[i - 1]);
      val_a += dir * pass;
      val_b += dir * pass;
      if (val_a < 0) {
        a -= val_a;
        val_a = 0;
      }
      if (val_b < 0) {
        b += val_b;
        val_b = 0;
      }
      if (val_a > x) {
        a += (val_a - x);
        val_a = x;
      }
      if (val_b > x) {
        b -= (val_b - x);
        val_b = x;
      }
      if (a > b) {
        a = b = 0;
      }
      val_a = x - val_a;
      val_b = x - val_b;
      out = -out;
    }
//    cerr << "after " << i << ": " << a << " " << val_a << " " << b << " " << val_b << " " << out << endl;
  }
  return 0;
}*/
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
const int N = 100000;

int a[N], t[N], result[N];

int main()
{
    int x, n, q;
    while (scanf("%d%d", &x, &n) == 2)
    {
        vector<std::pair<int, int>> events;
        for (int i = 0, turn; i < n; ++ i) 
        {
            scanf("%d", &turn);
            events.emplace_back(turn, -1);
        }
        int q;
        scanf("%d", &q);
        for (int i = 0; i < q; ++ i) 
        {
            scanf("%d%d", t + i, a + i);
            events.emplace_back(t[i], i);
        }
        sort(events.begin(), events.end());
        int dir = -1, i = 0, j = x, yi = 0, yj = x, t0 = 0;
        for (auto&& event : events)
        {
            int t = event.first;
            if (t0 < t)
            {
                int dt = t - t0;
                if (dir == -1)
                {
                    if (yi >= dt)
                    {
                        yi -= dt;
                        yj -= dt;
                    } else if (yj < dt)
                    {
                        i = j = yi = yj = 0;
                    } else
                    {
                        i += dt - yi;
                        yi = 0;
                        yj -= dt;
                    }
                } else
                {
                    if (yj + dt <= x)
                    {
                        yi += dt;
                        yj += dt;
                    } else if (yi + dt > x)
                    {
                        i = j = 0;
                        yi = yj = x;
                    } else
                    {
                        j -= yj - (x - dt);//?
                        yj = x;
                        yi += dt;
                    }
                }
            }
            t0 = t;
            int id = event.second;
            if (id!=-1) 
            {
                if (a[id] < i) 
                {
                    result[id] = yi;
                } else if (a[id] > j) 
                {
                    result[id] = yj;
                } else 
                {
                    result[id] = yi + (a[id] - i);
                }
            } else 
            {
                dir *= -1;
            }
        }
        for (int i = 0; i < q; ++ i) 
        {
            printf("%d\n", result[i]);
        }
    }
}


Measured memory_bytes: 4080