#include <bits/stdc++.h>
using namespace std;
long long h[100001] = {0};
long long hops[100001] = {0};
long long previous[100001] = {0};
long long ans[100001] = {0};
int main() {
  int n, d;
  cin >> n >> d;
  int end_point = 1;
  for (int i = 1; i <= n; ++i) {
    cin >> h[i];
    hops[i] = 1;
    for (int j = max(1, i - 500); j < i; j++) {
      if (abs(h[i] - h[j]) >= d && hops[j] + 1 > hops[i]) {
        hops[i] = hops[j] + 1;
        previous[i] = j;
      }
      if (hops[i] > hops[end_point]) {
        end_point = i;
      }
    }
  }
  cout << hops[end_point] << '\n';
  int T = previous[end_point];
  int cnt = 0;
  ans[cnt] = end_point;
  while (T) {
    ans[++cnt] = T;
    T = previous[T];
  }
  for (int i = cnt; i >= 0; i--) {
    cout << ans[i] << " ";
  }
  return 0;
}
