Given a set size $n$ consisting of elements from $1 \rightarrow n$, choose $k$ elements from the set such that their summand equals $S$, if possible
For ex: $n = 5$ (i.e the choices $\{1,2,3,4,5\}$), $k = 3$ and $S=9$ then elements chosen are $1,3$ and $5$
So is there a general formula or a general approach on how to choose such elements? because n and k can be really large.
You can give me the gist or go ahead.