# coding: utf-8

import bisect


def main():
    X = int(input())
    K = int(input())
    rs = tuple(map(int, input().split()))
    Q = int(input())

    D = [None] * K
    u, l, au, am, al = 0, 1, 2, 3, 4
    pr = None
    for i, r in enumerate(rs):
        d = [None] * 5
        if i == 0:
            d[u] = X
            d[l] = r
            d[au] = X - r
            d[am] = -r
            d[al] = 0
        else:
            pd = D[i-1]
            td = r - pr
            if i % 2 == 0:      # A -> B
                al_l = pd[al] - td
                if al_l >= 0:
                    d[u] = pd[u]
                    d[l] = pd[l]
                    d[au] = pd[au] - td
                    d[am] = pd[am] - td
                    d[al] = al_l
                else:
                    d[l] = pd[l] - al_l
                    d[al] = 0
                    d[au] = max(pd[au] - td, 0)
                    d[am] = max(pd[am] - td, 0)
                    if d[au] == 0:
                        d[u] = d[l]
                    else:
                        d[u] = pd[u]
            else:               # B -> A
                au_u = pd[au] + td
                if au_u <= X:
                    d[u] = pd[u]
                    d[l] = pd[l]
                    d[au] = au_u
                    d[am] = pd[am] + td
                    d[al] = pd[al] + td
                else:
                    au_d = au_u - X
                    d[u] = pd[u] - au_d
                    d[au] = X
                    d[am] = min(pd[am] + td, X)
                    d[al] = min(pd[al] + td, X)
                    if d[al] == X:
                        d[l] = d[u]
                    else:
                        d[l] = pd[l]
        D[i] = d
        pr = r
    # print(D)

    init_d = [X, 0, X, 0, 0]
    for q in range(Q):
        t, a = map(int, input().split())
        p = bisect.bisect(rs, t)
        if p == 0:
            pt = 0
            d = init_d
        else:
            pt = rs[p-1]
            d = D[p-1]
        if a <= d[l]:
            ta = d[al]
        elif a >= d[u]:
            ta = d[au]
        else:
            ta = a + d[am]
        td = t - pt
        if p % 2 == 0:          # A -> B
            ta = max(ta - td, 0)
        else:
            ta = min(ta + td, X)
        print(ta)


main()
