X = int(raw_input())
K = int(raw_input())
rs = map(int, raw_input().split(" "))
Q = int(raw_input())
qs = []

for q in xrange(Q):
  qs.append(map(int, raw_input().split(" ")))

l = len(qs)
for i in xrange(l):
  t = 0
  s = qs[i][1]
  end = qs[i][0]
  pre = 0
  k = 0
  while k < K:
    r = rs[k]
    if r >= end: break
    if k % 2 == 0:
      s = max(0, s - (r - pre))
    else:
      s = min(X, s + (r - pre))
    k += 1
    pre = r

  if k % 2 == 0:
    s = max(0, s - (end - pre))
  else:
    s = min(X, s + (end - pre))
  print s