Write a program that, given two numbers n and x, prints all the multisets that can be made up with {1, …, n}, in such a way that every number appears at most x times.
Input
Input consists of a natural number n > 0, followed by a natural number x > 0.
Output
Print all the multisets that can be made with {1, …, n}, using each number at most x times. The numbers inside each multiset must appear in non-decreasing order.
You can print the solutions to this exercise in any order.
Input
2 3
Output
{} {2} {2,2} {2,2,2} {1} {1,2} {1,2,2} {1,2,2,2} {1,1} {1,1,2} {1,1,2,2} {1,1,2,2,2} {1,1,1} {1,1,1,2} {1,1,1,2,2} {1,1,1,2,2,2}