#include <iostream>
#include <string>
using namespace std;
int main() {
int listSize, biggestSub;
cin >> listSize >> biggestSub;
int list[100000];
int ans = 0;
for (int i = 0; i < listSize; i++) {
cin >> list[i];
}
int index = 0;
int i, smallestInList, biggestInList;
while (index < listSize) {
i = 0;
smallestInList = 1000000001;
biggestInList = -1;
while (true) {
if (index + i == listSize) break;
else if (list[index + i] < smallestInList)
smallestInList = list[index + i];
else if (list[index + i] > biggestInList)
biggestInList = list[index + i];
if(biggestInList - smallestInList > biggestSub) break;
i++;
ans++
}
index++;
//ans += i;
}
cout << ans;
}