#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n + 1);
  for (int i = 0; i < (n); ++i) cin >> a[i + 1];
  int dp[300005];
  memset(dp, 0, sizeof(dp));
  dp[0] = 0;
  dp[1] = 1;
  int now = 1;
  for (int i = 2; i <= n; ++i) {
    int j = i - 1;
    bool can = false;
    while (dp[j] == now && j > 0 && !can) {
      if (abs(a[j] - a[i]) <= k) {
        now++;
        can = true;
      }
      j--;
    }
    dp[i] = now;
  }
  for (int i = 0; i < (n + 1); ++i) cout << dp[i] << " ";
  cout << endl;
  cout << dp[n] << endl;
  return 0;
}
