{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE Unsafe #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE FlexibleContexts #-}

import Data.Bits
import Data.List
import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.Lazy.Char8 as BSL
import Data.IntMap.Strict (IntMap)
import qualified Data.IntMap.Strict as IMS
import Data.IntSet (IntSet)
import qualified Data.IntSet as IS
import qualified Data.Sequence as Seq
import Data.Sequence (Seq)
import qualified Data.Array.IArray as A
import qualified Data.Array.MArray.Safe as A
import qualified Data.Array.MArray as A
import Data.Array (Array)
import Data.Array.Unboxed (UArray)
import Data.Array.IArray (IArray)
import Data.Array.MArray.Safe (MArray)
import Data.Array.IO.Safe (IOArray, IOUArray)
import Data.Array.ST.Safe (STArray, STUArray, runSTArray, runSTUArray)
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import Control.Monad
import Control.Monad.ST
-- import Control.Monad.ST.Safe
import Control.Applicative
import Data.Maybe
import Data.Tuple
import Data.Ord
import Control.Monad.State.Strict
import Data.Int
import System.IO
import Data.Function
import Control.Monad.Primitive
import qualified Data.Vector.Primitive.Mutable as VPM
import qualified Data.Vector.Generic.Mutable as VGM
import Data.STRef
import Data.IORef

main :: IO ()
main = do
  [n,q] <- map read . words <$> getLine :: IO [Int]
  as <- VU.unfoldrN n (BS.readInt . BS.dropWhile (==' ')) <$> BS.getLine
  let asum = VU.scanl' (+) 0 as
      aIntSum = VU.map fst $ VU.scanl' (\(!x,!y) a -> (y+a,x)) (0,0) as
  xs <- VU.unfoldrN q (BSL.readInt . BSL.dropWhile (<'!')) <$> BSL.getContents
  VU.forM_ xs $ \x ->
    print (query n as asum aIntSum x :: Int)

query n as asum aIntSum x
  = asum VU.! n - asum VU.! (n-divpt) + aIntSum VU.! (max 0 $ n-divpt*2)
  where
    ind_geqx = geq_binSearch x (-1) n
    -- How many entries >= x can takahashi take?
    divpt = divpt_binSearch 0 (n-ind_geqx+1)
    divpt_binSearch :: Int -> Int -> Int
    divpt_binSearch !ok !ng
      | ng - ok <= 1 = ok
      | (n-mid) - lowind +1 >= mid = divpt_binSearch mid ng
      | otherwise                  = divpt_binSearch ok mid
      where
        mid = (ng + ok) `shiftR` 1
        lowind = geq_binSearch (2*x - as VU.! (n-mid)) (-1) ind_geqx
    geq_binSearch :: Int -> Int -> Int -> Int
    geq_binSearch !goal !ng !ok
      | ok - ng <= 1 = ok
      | as VU.! mid >= goal = geq_binSearch goal ng mid
      | otherwise = geq_binSearch goal mid ok
      where
        mid = (ng + ok) `shiftR` 1
