

N,Q = gets.split.map(&:to_i)
a = gets.split.map(&:to_i).sort
cumsum = []
cumsumEven = []
sum,sumEven = 0,0
N.times do |i|
  sum += a[i]
  sumEven += a[i] if i % 2 == 0
  cumsum << sum
  cumsumEven << sumEven
end

Q.times do
  x = gets.to_i
  
  tmp = (0..10**9).bsearch do |y|
    l = (0..N-1).bsearch {|i| a[i] >= x-y} 
    r = (0..N-1).bsearch {|i| a[i] > x+y} || N
    r -= 1
    cnt = r - l + 1
    r+1 >= N-cnt
  end
  l2 = (0..N-1).bsearch {|i| a[i] >= x - tmp}
  l2 -= 1 if (N-l2).odd?
  l1 = (N+l2)/2
  ans = cumsum[N-1]-cumsum[l1-1]
  if l2 > 0
    ans += (l2-1).odd? ? cumsum[l2-1] - cumsumEven[l2-1] : cumsumEven[l2-1]
  end
  p ans
end
