function main() {
  var nd = readline()
    .split(' ')
    .map(s => Number(s));
  var set = readline()
    .split(' ')
    .map(s => Number(s));
  var n = nd[0];
  var d = nd[1];

  var min = 100000000;
  var max = -1;
  var prevMax = -1;
  var count = 0;

  for (var i = 0; i < n; i++) {
    if (set[i] < min) {
      min = set[i];
    }
    if (set[i] > max) {
      prevMax = max;
      max = set[i];
    }
    if (max - set[i] > d || set[i] - min > d) {
      count++;
      max = prevMax;
    }
  }

  print(count);
}

main();
