It is necessary and sufficient that

$\lim_{n \rightarrow \infty}a_n = 0$, and

$a_n \leq \sum_{m > n}a_m$ for all $n$.

In other words: the terms go to zero, and no term is bigger than the sum of all the following terms.

*Necessity*: First, it is necessary that $\lim_{n \rightarrow \infty}a_n = 0$ because you cannot form any sum smaller than $\lim_{n \rightarrow \infty}a_n$.

Suppose $a_n > \sum_{m > n}a_m$ for some $n$. Let $\varepsilon$ be some number with $0 < \varepsilon < a_n - \sum_{m > n}a_m$. Then I claim there is no $A$ such that $\sum_{m \in A}a_m = a_1+a_2+\dots+a_{n-1}+a_n - \varepsilon$. To see this, just consider two cases: (1) if $\{a_1,\dots,a_n\} \subseteq A$, then $\sum_{m \in A}a_m$ is too big, because $\varepsilon > 0$, and (2) if $a_i \notin A$ for some $i \leq n$, then $\sum_{m \in A}a_m$ is too small, because
$\sum_{m \in A}a_m \,\leq\, (a_1+a_2+\dots+a_n) - a_i +\sum_{m > n}a_m \,\leq\, (a_1+a_2+\dots+a_n) -a_n + \sum_{m > n}a_m < (a_1+a_2+\dots+a_n) - \varepsilon.$

*Sufficiency:* Suppose $a_n \leq \sum_{m > n}a_m$ for all $n$, and let $c$ be any number with $0 \leq c \leq \sum_{m \in \mathbb N}a_m$. Then we can construct the desired $A \subseteq \mathbb N$ recursively, as follows. If it has already been decided for all $m < n$ whether $m \in A$ or not, then put $n \in A$ if and only if $a_n + \sum_{m \in A \cap \{1,2,\dots,n-1\}} a_m \leq c$. (In other words, put $n \in A$ if and only if putting $n \in A$ does not make the sum too big.) Once we have built $A$ according to this rule, it is clear that $\sum_{m \in A}a_m \leq c$, because none of the finite partial sums exceeds $c$.

Now suppose, aiming for a contradiction, that $\sum_{m \in A}a_m < c$, and let $\varepsilon = c - \sum_{m \in A}a_m$. There is some $N$ such that $a_n < \varepsilon$ for all $n \geq N$. For each such $n$, we have $\sum_{m \in A \cap \{1,2,\dots,n-1\}} a_m \leq \sum_{m \in A} a_m = c - \varepsilon$, and hence $a_n + \sum_{m \in A \cap \{1,2,\dots,n-1\}} a_m < c$. By our rule for constructing $A$, this means $n \in A$ for all $n \geq N$. In other words, $A$ is a co-finite subset of $\mathbb N$.

Let $n$ denote the largest member of $\mathbb N \setminus A$. (Note that $\mathbb N \setminus A \neq \emptyset$, because $\sum_{m \in A}a_m < c \leq \sum_{m \in \mathbb N}a_m$.) Then $\left( \sum_{m \in A \cap \{1,2,\dots,n-1\}} a_m \right)+a_n \leq \left( \sum_{m \in A \cap \{1,2,\dots,n-1\}} a_m \right)+ \sum_{m > n}a_m = \sum_{m \in A}a_m < c$. This is the contradiction we were after, because this tells us that we should have had $n \in A$, although $n$ was supposed to be the largest number not in $A$.

1more comment