\problemname{Atomic Energy}

% optionally define variables/limits for this problem
\providecommand{\maxn}{}
\renewcommand{\maxn}{100}
\providecommand{\maxa}{}
\renewcommand{\maxa}{10^9}
\providecommand{\maxq}{}
\renewcommand{\maxq}{10^5}
\providecommand{\maxk}{}
\renewcommand{\maxk}{10^9}

\illustration{0.35}{atom}{\href{https://unsplash.com/photos/OgvqXGL7XO4}{Plasma ball} by Halacious, Unsplash}%
The \textit{Next Wave Energy Research Club} is looking at several atoms as potential energy sources, and has asked
you to do some computations to see which are the most promising.

Although an atom is composed of various parts, for the purposes of this method only the number of neutrons in
the atom is relevant\footnote{In fact, for this problem you might want to forget everything you thought you knew
about chemistry.}. In the method, a laser charge is fired at the atom, which then releases energy in a process
formally called \textit{explodification}. Exactly how this process proceeds depends on the number of neutrons $k$:
\begin{itemize}
	\item If the atom contains $k \leq n$ neutrons, it will be converted into $a_k$ joules of energy.
	\item If the atom contains $k > n$ neutrons, it will decompose into two atoms with $i$ and $j$ neutrons
		respectively, satisfying $i,j \geq 1$ and $i+j=k$. These two atoms will then themselves explodificate.
\end{itemize}

When an atom with $k$ neutrons is explodificated, the total energy that is released depends on the exact sequence
of decompositions that occurs in the explodification process. Modern physics is not powerful enough to predict
exactly how an atom will decompose---however, for explodification to be a reliable energy source, we need to know 
the minimum amount of energy that it can release upon explodification. You have
been tasked with computing this quantity.

\begin{Input}
The input consists of:
\begin{itemize}
    \item One line with two integers $n$ and $q$ ($1 \leq n \leq \maxn$, $1 \leq q \leq \maxq$), the neutron threshold and the number of experiments.
    \item One line with $n$ integers $a_1,\ldots,a_n$ ($1 \leq a_i \leq \maxa$ for each $i$), where $a_i$ is the
		amount of energy released when an atom with $i$ neutrons is explodificated.
    \item Then $q$ lines follow, each with an integer $k$ ($1 \leq k \leq \maxk$), asking for the minimum
		energy released when an atom with $k$ neutrons is explodificated.
\end{itemize}
\end{Input}

\begin{Output}
For each query $k$, output the minimum energy released when an atom with $k$
neutrons is explodificated.
\end{Output}

