Create an boolean array of the same size as the given array.

Now for every integer we have two options, whether to select it or ignore it.

Now if we select it, we will put TRUE in the boolean array at the corresponding index or if we ignore it, put FALSE at that index.

We will start with currentLength =0 and do the recursive calls for both the options mentioned in the previous step.

If we select an integer to print, make currentLength +1 and if we ignore, dont change currentLength.

Another important factor is from which index you will start making the subset of size k. Initialize start = 0, and with every recursive call, make start + 1 ( for both the scenarios mentioned in the steps above).

If you find anything incorrect or you feel that there is any better approach to solve the above problem, please write comment.
__________________________________________________