x = gets.to_i
k = gets.to_i
r = [0] + gets.split.map(&:to_i)
q = gets.to_i
t, a = [], []
q.times do |i|
    t[i], a[i] = gets.split.map(&:to_i)
end

a_is_upside = true

1.upto(k) do |k_i|
    break if a.empty?
    if t.first < r[k_i]
        if a_is_upside
            p [a.first - (t.first - r[k_i - 1]), 0].max
        else
            p [a.first + (t.first - r[k_i - 1]), x].min
        end
        a.shift
        t.shift
        redo
    end
    dr = r[k_i] - r[k_i - 1]
    a.each_with_index do |aa, ai|
        if a_is_upside
            if aa <= dr
                a[ai] = 0
            else
                a[ai] -= dr
            end
        else
            if aa >= x - dr
                a[ai] = x
            else
                a[ai] += dr
            end
        end
    end
    a_is_upside = !a_is_upside
end

a.each_with_index do |aa, ai|
    if a_is_upside
        p [a.first - (t.first - r.last), 0].max
    else
        p [a.first + (t.first - r.last), x].min
    end
end