#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 10;
int dp[maxN], sz, n, par[maxN];
long long a[maxN], b[maxN];
map<long long, int> ind;
pair<long long, int> data[4 * maxN];
void upd(int p, int x, int pos, int s = 0, int e = n, int id = 1) {
  if (data[id].first < x) {
    data[id].first = x;
    data[id].second = pos;
  }
  if (e - s < 2) return;
  int mid = s + e >> 1;
  if (p < mid)
    upd(p, x, pos, s, mid, 2 * id);
  else
    upd(p, x, pos, mid, e, 2 * id + 1);
}
pair<long long, int> get(int l, int r, int s = 0, int e = n, int id = 1) {
  if (e <= l || r <= s) return make_pair(-1, 0);
  if (l <= s && e <= r) return data[id];
  int mid = s + e >> 1;
  pair<long long, int> ret = get(l, r, s, mid, 2 * id);
  ret = max(get(l, r, mid, e, 2 * id + 1), ret);
  return ret;
}
int32_t main() {
  for (int i = 0; i < maxN; i++) par[i] = -1;
  int d;
  cin >> n >> d;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  sort(b, b + n);
  for (int i = 0; i < n; i++) ind[b[i]] = i;
  for (int i = 0; i < n; i++) {
    int r, l;
    r = upper_bound(b, b + n, a[i] - d) - b;
    l = lower_bound(b, b + n, a[i] + d) - b;
    int mx = -1, idx = 0;
    if (a[i] - d >= 0 && r > 0) {
      pair<int, int> cur = get(0, r);
      mx = cur.first;
      idx = cur.second;
    }
    if (l != n) {
      pair<int, int> cur = get(l, n);
      if (cur.first > mx) {
        mx = cur.first;
        idx = cur.second;
      }
    }
    dp[i] = mx + 1;
    par[i] = idx;
    upd(ind[a[i]], dp[i], i);
  }
  int ans = 0;
  for (int i = 0; i < n; i++)
    if (dp[i] > dp[ans]) ans = i;
  cout << dp[ans] << endl;
  int cur = ans;
  vector<int> res;
  for (int i = 0; i < dp[ans]; i++) {
    res.push_back(cur);
    cur = par[cur];
  }
  reverse(res.begin(), res.end());
  for (int i = 0; i < res.size(); i++) cout << res[i] + 1 << " ";
  cout << endl;
  return 0;
}
