#include <bits/stdc++.h>
using namespace std;
vector<int> a(200005);
void solve() {
  long long n, k;
  cin >> n >> k;
  long long a[n];
  vector<long long> vv;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cout << a[0] << " ";
  for (int i = 1; i < n; i++) {
    if (abs(a[i] - a[i - 1]) <= k) {
      cout << a[i] << " ";
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
