# include <bits/stdc++.h>
# define maxn 500001
# define ll long long
# define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
# define rc(s) return cout << s,0
# define _ ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
# define pb push_back
# define mp make_pair
//# define int ll
using namespace std;
const int inf = INT_MAX;
int n,k;
int32_t main(){_
freopen("combinari.in","r",stdin);
freopen("combinari.out","w",stdout);
cin >> n >> k;
for(int mask = 1;mask <= (1 << n) - 1;mask++)
{
if(__builtin_popcount(mask) == k)
{
for(int i = 0;i<n;i++)
{
if(mask & (1 << i)) cout << i + 1 << ' ';
}
cout << '\n';
}
}
return 0;
}