// author: khba
#include "bits/stdc++.h"
using namespace std;
#define int long long
const int inf = (int)1e18;
#ifdef khba
#include "C:\Users\Asus\Desktop\khba\debug.h"
#else
#define print(...) 42
#endif
int32_t main() {
#ifdef khba
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, M, add = 0; cin >> n >> M;
vector <int> a(n);
for (int &i : a) cin >> i;
for (int i = 0; i < n; ++i) a[i] -= (i + 1) * M;
for (int i = 0; i < n; ++i) {
a[i] = -a[i];
if (a[i] < 0) add += 1;
}
vector <int> dp(n);
for (int i = 0; i < n; ++i) if (a[i] >= 0) {
for (int j = 0; j < i; ++j) if (a[j] >= 0 and a[j] <= a[i]) dp[i] = max(dp[i], dp[j] + 1);
}
cout << *max_element(begin(dp), end(dp)) + add;
return 0;
}