#include<bits/stdc++.h>
using namespace std;
vector<int> a;
vector<int> temp;
int find_lis(){
vector<int> dp;
for(int i : a){
int pos = upper_bound(dp.begin(), dp.end(), i) - dp.begin();
if (pos == dp.size()) {
dp.push_back(i);
}else{
dp[pos] = i;
}
}
return dp.size();
}
int main(){
int n, m;
cin >> n >> m;
for(int i = 0; i < n; i++){
int x;
cin >> x;
temp.push_back(x);
}
for(int i = 1; i <= n; i++){
if(i * m >= temp[i-1]) {
a.push_back(i * m - temp[i-1]);
}
}
cout << n-find_lis() << endl;
return 0;
}