# Finding Subset-Sum with low cardinality

Is there any way to determine if a given Sum can be formed by taking minimum number of elements of a set/array.
Repetition of array elements is allowed.I tried brute force taking a map n dovetailing through.
Eg. {1,2,3,4,5}and the sum to be formed is 8. Then {3,5} or {4,4}.
Therefore the size of minimum set is 2,repitition is allowed.
[** Note: Even if you take same element twice it is counted as two.]

-
Of course there is a way to determine if a given sum $S$ can be formed by taking a minimum number of elements of a set $X$; just try every one-element subset of $X$, then every two-element subset, and so on, until you get $S$ or know you can never get $S$. So, what's your question, really? –  Gerry Myerson Dec 2 '12 at 6:18
I mean is there a way to do it efficiently??Problem is simple incase when duplicates arent allowed.bt wid duplicates complexity increases –  Queue Tank Dec 2 '12 at 6:26
Subset-Sum is the name of a problem where numbers can be taken at most once, which is actually harder than the problem you are describing, so the title is confusing. I'm also not sure what you mean by low cardinality, or how efficient of a solution you are looking for. You're really interested in non-negative solutions to a diophantine equation. –  William Macrae Dec 2 '12 at 8:44