nq = gets.chomp.split(" ").map{|a| a.to_i}
n = nq[0]
q = nq[1]
ary = gets.chomp.split(" ").map{|a| a.to_i}
xx = Array.new(q)
for i in (0..q-1)
  xx[i] =gets.to_i
end
answers=Array.new

xx.each{|x|
  aa = ary.dup
  answer = 0
(n/2).times do
  answer += aa.pop
  aa.delete(aa.min_by{|aaa| (aaa-x).abs})
end
  if aa.size==1 then
    answer +=aa[0]
  end
    answers.push(answer)
}
answers.each{|ans|
puts ans}
