I'm relatively new to exact-cover and similar problems, so please bear with me. Suppose I have a typical exact-cover problem, ie. given a set X and a collection of X's subsets S, I want to find S* (a subset of S) that exact-covers X. However, I want the solution S* to contain exactly k elements. Moreover, one solution is enough.
I know that Knuth's Algorithm X is designed to return all possible solutions. Should I just run Knuth's Algorithm and iterate through the solutions until I find one with k elements, or is there (as I suspect) a much better way? I'm using Python btw.
For context, X's size is <100 but S's size can be 10^6. k is relatively small at <10.