X = gets.to_i
K = gets.to_i
rs = [0] + gets.split.map(&:to_i)

sat_ub = [X]
sat_lb = [0]
val_lb = [0]
(1..K).each do |k|
    rd = rs[k] - rs[k-1]
    if k % 2 == 1   # パーツA減少
        if val_lb[k-1] - rd < 0
            val_lb[k] = 0
            sat_lb[k] = sat_lb[k-1] + (rd - val_lb[k-1])
        else
            val_lb[k] = val_lb[k-1] - rd
            sat_lb[k] = sat_lb[k-1]
        end
        sat_ub[k] = sat_ub[k-1]
        sat_lb[k] = sat_ub[k] if sat_lb[k] > sat_ub[k]
    else
        val_ub = val_lb[k-1] + sat_ub[k-1] - sat_lb[k-1]
        if val_ub + rd > X
            sat_ub[k] = sat_ub[k-1] - (val_ub + rd - X)
        else
            sat_ub[k] = sat_ub[k-1]
        end
        val_lb[k] = val_lb[k-1] + rd
        val_lb[k] = X if val_lb[k] > X
        sat_lb[k] = sat_lb[k-1]
        sat_ub[k] = sat_lb[k] if sat_ub[k] < sat_lb[k]
    end
end

Q = gets.to_i
Q.times do
    t, a = gets.split.map(&:to_i)
    i = 0 #K.times.to_a.bsearch{|k|  rs[k+1] > t} || K
    if a <= sat_lb[i]
        start = val_lb[i]
    elsif a <= sat_ub[i]
        start = val_lb[i] + a - sat_lb[i]
    else
        start = val_lb[i] + sat_ub[i] - sat_lb[i]
    end
    if i % 2 == 0 # パーツA減少
        result = start - (t - rs[i])
        result = 0 if result < 0
    else
        result = start + (t - rs[i])
        result = X if result > X
    end
    puts result
end

