This is a variation of the problem of summing a subset , which is NP-Hard - so there is no known polynomial solution for it . (In fact, the problem of the sum of the subsets says that it is difficult to find if there is at least one subset that can be summed with a given sum).
Possible approaches to solving it are brute force (check all possible subsets), or if the set contains relatively small integers, you can use the pseudopolynomial dynamic programming method:
f(i,0) = 1 (i >= 0)
f(0,j) = 0 (j != 0)
f(i,j) = f(i-1,j) + f(i-1,j-arr[i])
Applying dynamic programming to the recursive formula above gives you a O(k*n)temporary and spatial solution.
A call with f(n,k)[assuming the index is based on 1 for arrays].