#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 1e6 + 10;
int res[N];
vector<int> ans[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  if (n / k < 3) {
    cout << "-1";
    return 0;
  }
  if (k == 2) {
    int flag = 0;
    for (int i = 1; i + 1 <= n - 2; i += 2) {
      if (flag == 0)
        cout << 1 << " " << 1 << " ";
      else
        cout << 2 << " " << 2 << " ";
      flag = 1 - flag;
    }
    cout << 1 << " " << 2 << "\n";
    return 0;
  }
  int x = n / k, cnt = 1;
  for (int i = 1; i <= k; i++) {
    if (i == k) {
      for (int j = cnt; j <= n; j++) ans[i].push_back(j);
      break;
    } else {
      for (int j = cnt; j < cnt + x; j++) ans[i].push_back(j);
      cnt += x;
    }
  }
  for (int i = 1; i <= k; i++) {
    reverse(ans[i].begin(), ans[i].end());
  }
  vector<int> vv;
  for (int i = 1; i <= k; i++) {
    vv.push_back(ans[i].back());
    ans[i].pop_back();
  }
  int indx = 0;
  for (int i = 1; i <= k; i++) {
    if (i + 1 <= k)
      ans[i + 1].push_back(vv[indx++]);
    else
      ans[1].push_back(vv[indx++]);
  }
  for (int i = 1; i <= k; i++) {
    for (auto it : ans[i]) res[it] = i;
  }
  for (int i = 1; i <= n; i++) cout << res[i] << " ";
  cout << '\n';
  return 0;
}
