import java.util.*;
public class Main{
static int n = 0, m = 0;
static class State{
int pos, u, sum, state;
public State(int pos, int u, int sum, int state){
this.pos = pos;
this.u = u;
this.sum = sum;
this.state = state;
}
}
private static void dfs(int u, int sum, int state){
// 0
if(sum + n - u < m){
return;
}
if(sum == m){
for(int i = 0; i <= n; i++){
if((state >> i & 1) == 1){
System.out.print(i+1+" ");
}
}
System.out.println();
return;
}
dfs(u+1,sum+1,state | 1 << u);
// 1
dfs(u+1,sum,state);
// 2
}
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
m = sc.nextInt();
dfs(0,0,0);
Deque<State> q = new LinkedList<>();
q.addLast(new State(0,0,0,0));
while(!q.isEmpty()){
State t = q.removeLast();
if(t.pos == 0){
if(t.sum + n - t.u < m){
continue;
}
if(t.sum == m){
for(int i = 0; i <= n; i++){
if((t.state >> i & 1) == 1){
System.out.print(i+1+" ");
}
}
// 这里特殊处理一下 m == 0的情况
if(t.sum != 0)
System.out.println();
continue;
}
q.addLast(new State(t.pos+1,t.u+1,t.sum+1,t.state|1<<t.u));
}else if(t.pos == 1){
q.addLast(new State(t.pos+2,t.u,t.sum,t.state));
}else{
continue;
}
}
}
}