Suppose I have an $M\times N$ binary matrix where $N$ can be large (say $N\approx10^6$). I want to find exactly $k$ columns ($k$ is relatively small, say $k<10$) such that the sum of those $k$ columns is the 1-vector (an $M$-dimensional vector with all components being 1). One solution is adequate.
For example, an algorithm working on the matrix $$\begin{pmatrix} 1 & 0 & 0\\ 1 & 0 & 0\\ 1 & 1 & 0\\ 0 & 1 & 1\\ \end{pmatrix}$$ should return columns 1 and 3 if $k=2$, but should report no solutions if $k=1$ or $k=3$.
I can get my computer to do an exhaustive check, but the best I've managed so far is worst-case $O(N^k)$ time complexity. I wonder whether there are any linear algebra, combinatorial or other techniques that can simplify the search? To be clear, the aim of this question is not necessarily about writing more efficient code, but rather if there are any maths tricks I can use to help simplify the problem. Thanks!
I've also asked this question on Stack Overflow where I'm more interested in help on improving algorithmic efficiency. The code I've used for exhaustive searching is there if you're interested.