#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define nl "\n"
#define OO 0x3f3f3f3f
using namespace std;

void ta2to2a()
{
    ios_base::sync_with_stdio(false), cout.tie(nullptr), cin.tie(nullptr);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
int n, m;
vector<ll> v;
void sequence(int start)
{
    v.push_back(start);
    if (v.size() == n)
    {
        for (auto it : v)
        {
            cout << it << " ";
        }
        cout << nl;
        return;
    }
    for (int i = start; i < m; i++)
    {
        sequence(i + 1);
        v.pop_back();
    }
}
void solve()
{
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
    {
        sequence(i);
        v.clear();
    }
}
int main()
{
    ta2to2a();
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
}