#include <bits/stdc++.h>
using namespace std;
bool sortby(string a, string b) {
  transform(a.begin(), a.end(), a.begin(), ::tolower);
  transform(b.begin(), b.end(), b.begin(), ::tolower);
  return a < b;
}
int main() {
  long long in = 1, o;
  int n, k;
  cin >> n >> k;
  vector<long long> v;
  int mn = 0;
  for (int i = 0; i < n; ++i) {
    long long t;
    cin >> t;
    v.push_back(t);
    if (i < k) {
      if (v[mn] > t) mn = i;
    }
  }
  long long last = v[mn];
  int ans = 1;
  for (long long i = mn + 1; i < n; ++i) {
    if (abs(v[i] - last) <= k) {
      ans++;
      last = v[i];
      cout << v[i] << "\n";
    }
  }
  cout << ans << "\n";
}
