#include <cstdio>
#include <iostream>
#include <vector>
#include <cassert>

using namespace std;

int main()
{
    freopen("haircut.in", "r", stdin);
    freopen("haircut.out", "w", stdout);
    int n, k;
    cin >> n >> k;
    assert(2 <= n && n <= 100000);
    assert(1 <= k && k <= n);
    int kol = n / k;
    int k1 = n - kol * k;
    int k2 = k - k1;
    int tek = 2;
    vector<int> ans(n + 1);
    for (int i = 0; i < k1; i++)
        for (int j = 0 ; j <= kol; j++)
        {
            ans[tek] = i + 1;
            tek++;
            if (tek > n) tek = 1;
        }
    for (int i = 0; i < k2; i++)
        for (int j = 0 ; j < kol; j++)
        {
            ans[tek] = i + k1 + 1; 
            tek++;
            if (tek > n) tek = 1;
        }
    for (int i = 1; i < n; i++)
       cout << ans[i] << " ";
    cout << ans[n] << endl; 

}