// Sky's the limit :) #include using namespace std; #define int long long signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int T = 1; // cin >> T; while (T--) { int n, d; cin >> n >> d; vector a; for (int i = 1; i <= n; i++) { int x; cin >> x; a.push_back(x); auto it = lower_bound(a.begin(), a.end(), x - d + 1) - a.begin(); cout << it << '\n'; } } return 0; }