Binod and his family live in Codingland. They have a festival called N-Halloween.
The festival is celebrated for N  consecutive days. On each day Binod gets some candies from his mother. He may or may not take them. On a given day ,  Binod will be sad if he collected candies on that day and he does not have at least X   candies remaining  from the candies he collected that day at the end of that day . His friend Pelu who is very fond of candies asks for X  candies from Binod on a day if Binod collects any candy on that day. He does so immediately after Binod collects them. Binod being a good friend never denies him.  

Given a list a   where ai   denotes the number of candies Binod may take on the ith   day and  Q  queries having a number X , find the maximum number of candies Binod can collect so that he won't be sad after the festival ends.
Input format: 

First-line contains two integers N and Q denoting the number of festival days and number of queries respectively.

The second line is the array whose ith   element is the maximum number of candies Binod may
collect on that day.

Each of the next Q lines contains the number X i.e the minimum number of candies Binod wants to have at the end of every day on which he collects any candy.
Output format: 

For every query output, a single integer denoting the max number of candies Binod may
collect (for the given X ) to be happy after the festival ends.
Constraints:  

1<=N,Q<=105  

1<=Q<=105  

0<=ai<=109  

0<=X<=109  

Sample Input : 

5 2

4 6 5 8 7

1

2

Sample Output : 

30

30

Sample Input:  

6 3 

20 10 12 3 30 5 

2 

6 

13 

Sample Output  

77 

62 

30 

Explanation: 

In the first query of sample input 1, Binod can collect the maximum number of given chocolates for a given day each day as after the end of every day Binod will have a number of collected
chocolates on that day greater than equal to 1 even after giving 1 chocolate to Pelu. So the
the answer is 4+6+5+8+7=30.

Difficulty: UNKNOWN_DIFFICULTY

Solutions:
import copy
import bisect
(n, q) = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
b = copy.copy(a)
for i in range(1, len(b)):
	b[i] += b[i - 1]
for i in range(q):
	x = int(input())
	ans = bisect.bisect_left(a, x * 2)
	if ans == 0:
		ans1 = b[n - 1]
	else:
		ans1 = b[n - 1] - b[ans - 1]
	print(ans1)


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import random
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_right(a, x)
	if i != len(a):
		return i
	else:
		return -1

def find_ge(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		(n, Q) = In()
		l = list(In())
		l.sort()
		pre = [0]
		su = 0
		for x in range(n):
			su += l[x]
			pre.append(su)
		for x in range(Q):
			q = I()
			q *= 2
			pos = find_ge(l, q)
			if pos == -1:
				print(0)
			else:
				ans = pre[-1] - pre[pos]
				print(ans)
	except:
		pass
M = 998244353
P = 1000000007

def __starting_point():
	for _ in range(1):
		main()
__starting_point()


(n, q) = list(map(int, input().split()))
l = list(map(int, input().split()))
l.sort(reverse=True)
p = []
p.append(l[0])
for i in l[1:]:
	p.append(p[-1] + i)

def bs(l, c):
	i = 0
	j = len(l) - 1
	ans = -1
	while i <= j:
		mid = i + (j - i) // 2
		if l[mid] >= c:
			ans = mid
			i = mid + 1
		else:
			j = mid - 1
	return ans
for _ in range(q):
	x = int(input())
	x = bs(l, 2 * x)
	if x == -1:
		print(0)
	else:
		print(p[x])