12965 - Combinations   

Description

The testcases of this problem have been update at 2020/11/14 18:26. Sorry for the inconvenience.
A combination is a selection of items from a collection, such that the order of selection does not matter (unlike Permutations).

You have to write a program to output all combinations of choosing M items from the given array A whose size is N.

Input

First line contains two integers N, M (1 <= M <= N <= 22).

Second line contains N distinct integers Ai (1 <= A<= 100) sorted by ascending order.

Output

Output all the n choose m combinations by lexicographic order.
For each combination, you must print it with ascending order and seperated by a space.
Remember to add a newline character('\n') at the end of every line.

Sample Input  Download

Sample Output  Download

Tags




Discuss