# Pick $3$ numbers from $1$ to $10$ (without repetition) so that the sum of those numbers a) equals $9$ b) is less then $9$

We are given positive integer numbers from $1$ to $10$, and we have to pick $3$ numbers from those $10$ so that the sum of those numbers (repetition of numbers in a sum is not allowed):

$a)$ equals $9$

$b)$ is less then $9$

$a)$ It is clear that those sums are: $\quad6+2+1=9;\quad 5+3+1=9; \quad4+3+2=9$ . However, I am interested in method or explicit formula for solving this type of problem, do I have to partition the integers by cases, which could be a long process. For example, what if the sum of that $3$ numbers from some given set was supposed to be $857$ instead of $9$, the partitioning of $857$ could last very long.

$b)$ The same slow method of partitioning by cases comes to mind, of course, excluding the integers $10,9,8,7,6$.

Given a (finite) set of numbers $A\subset \mathbb{Z}$ and one number $s\in\mathbb{Z}$, is there a subset $B\subset A$ such that the numbers in $b$ precisely add up to $s$?