// 需要反复取的时候才要循环判断,只向后取直接把状态传下去就可以了
// 不需要所有状态空间,所以可以剪枝
import java.util.*;
import java.util.stream.*;
public class Main{
void run(){
int n = jin.nextInt();
int m = jin.nextInt();
dfs(0, n, m, 0, 0);
}
void dfs(int start, int n, int m, int sum, int status){
if (sum == m ){
buffer.clear();
for (int i = 0 ; i < n ;i ++){
if (((status >> i) & 1) == 1 ){
buffer.add(i+1);
}
}
String res = String.join(" ", buffer.stream().map(String::valueOf).collect(Collectors.toList()));
System.out.println(res);
} else if (n - start + sum >= m){
dfs(start+1, n, m, sum+1, status | (1 << start));
dfs(start+1, n, m, sum, status);
}
}
private List<Integer> buffer = new ArrayList<>();
private Scanner jin = new Scanner(System.in);
public static void main(String[] args) throws Exception {new Main().run();}
}