#include <bits/stdc++.h>
using namespace std;
vector<long long> g[100500];
void dfs(long long v) {
  for (long long j = 0; j < g[v].size(); j++) {
    long long to = g[v][j];
    dfs(to);
  }
}
long long pow_x(long long a, long long x) {
  if (!x) return 1;
  if (x & 1) {
    long long b = pow_x(a, x / 2);
    return b * b;
  }
  return a * pow_x(a, x - 1);
}
vector<int> p[1000001];
int in[1000500];
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  if (n / k < 3) return cout << -1, 0;
  int cur = 1;
  for (int i = 0; i < k - 1; i += 2) {
    p[i].push_back(cur);
    p[i].push_back(cur + 1);
    p[i].push_back(cur + 3);
    p[i + 1].push_back(cur + 2);
    p[i + 1].push_back(cur + 4);
    p[i + 1].push_back(cur + 5);
    cur += 6;
  }
  bool ok = false;
  if (k & 1) {
    if (n % k == 0 && n / k == 3) {
      p[k - 1].push_back(p[k - 2][0]);
      p[k - 2].erase(p[k - 2].begin());
      p[k - 2].push_back(n);
      p[k - 1].push_back(n - 1);
      p[k - 1].push_back(n - 2);
    } else {
      ok = true;
      p[k - 1].push_back(cur);
      p[k - 1].push_back(cur + 1);
      p[k - 1].push_back(cur + 3);
      cur += 2;
    }
  }
  if (ok) {
    p[0].push_back(cur);
    cur += 2;
  }
  for (int i = cur; i <= n; i++) {
    p[0].push_back(i);
  }
  for (int i = 0; i < k; i++) {
    for (int j = 0; j < p[i].size(); j++) {
      in[p[i][j]] = i + 1;
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << in[i] << ' ';
  }
}
