#include <algorithm>
using namespace std;
#define N 100001
int aa[N], bb[N], ans; int M, K;
void Print()
{
for (int i = 1; i <=K; i++)
{
cout << bb[i] << " ";
}
cout << endl;
}
void dfs(int x,int h)
{
if (x > K) { Print(); return; }
for (int i = h + 1; i < M; i++)
{
bb[x] = aa[i]; int k = i;
dfs(x + 1,k);
}
}
int main()
{
cin >> M >> K;
for (int i = 0; i < M; i++)
cin >> aa[i];
dfs(1,-1);
return 0;
}
01-20
06-09
176
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
12-03
6385
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)