#include <bits/stdc++.h>
using namespace std;
char alf[] = "abcdefghijklmnopqrstuvwxyz";
void input(int *a, int n) {
  for (int i = 0; i < n; i++) cin >> a[i];
}
void print(int *a, int n) {
  for (int i = 0; i < n; i++) cout << a[i] << ' ';
  cout << endl;
  return;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int> > g(m);
  g[0] = {1, 2, 4};
  g[1] = {3, 5, 6};
  if (n >= 3 * m && n >= 6) {
    int mx = 6;
    for (int i = 7; i <= 3 * m; i += 3) {
      int x = i / 3 - 1;
      int d = g[x][1] - g[x][0];
      int y = g[x][2];
      if (i - g[x][1] == d) {
        g[x][2] = i + 1;
        g[x + 1] = {y, i, i + 2};
      } else {
        g[x][2] = i;
        g[x + 1] = {y, i + 1, i + 2};
      }
      sort(g[x + 1].begin(), g[x + 1].end());
      if (mx < g[x + 1][2]) mx = g[x + 1][2];
    }
    for (int i = mx + 1; i <= n; i++) {
      g[0].push_back(i);
    }
    int a[n];
    for (int i = 0; i < m; i++) {
      for (int j = 0; j < (int)g[i].size(); j++) {
        a[g[i][j] - 1] = i + 1;
      }
    }
    print(a, n);
  } else
    cout << -1 << endl;
  return 0;
}
