#include <iostream>
using namespace std;
int N,M;
char s[20]={0};
void permute(int x, int cnt) {
if (cnt==M) {
cout << s << "\n";
return;
}
for (int y=x;y<=N;y++) {
s[2*cnt]=y+'0';
s[2*cnt+1]=' ';
permute(y, cnt+1);
}
}
int main() {
cin.tie(0)->sync_with_stdio(0);
cin >> N >> M;
permute(1, 0);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwppbnQgTixNOwpjaGFyIHNbMjBdPXswfTsKdm9pZCBwZXJtdXRlKGludCB4LCBpbnQgY250KSB7CiAgICBpZiAoY250PT1NKSB7CiAgICAgICAgY291dCA8PCBzIDw8ICJcbiI7CiAgICAgICAgcmV0dXJuOwogICAgfQogICAgZm9yIChpbnQgeT14O3k8PU47eSsrKSB7CiAgICAgICAgc1syKmNudF09eSsnMCc7CiAgICAgICAgc1syKmNudCsxXT0nICc7CiAgICAgICAgcGVybXV0ZSh5LCBjbnQrMSk7CiAgICB9ICAgIAp9CgppbnQgbWFpbigpIHsKICAgIGNpbi50aWUoMCktPnN5bmNfd2l0aF9zdGRpbygwKTsKICAgIGNpbiA+PiBOID4+IE07CiAgICBwZXJtdXRlKDEsIDApOwp9