We are given a number of locks and to open these locks we need exactly that set of people to open that lock. Given the number of people we have and the number of locks that
Let n be the total number of people, and let m be the desired minimum number of people to open all the locks.
Then, there are two requirements:
Putting these two requirements together, we actually have a one-to-one mapping between (keys) and (sets of n − m + 1 people).
So you just need to find all sets of n − m + 1 people (which is trivial to do in O(2n) time, and not too hard to do in O(C(n, n − m + 1)) time). For each set, create a key and distribute it to the people in that set.