def main():
    n,k = map(int,input().split())
    a = []
    for _ in range(n):
        a.append(int(input()))
    dp = [0] * n
    dp[0] = 1
    B = [0]
    for i in range(1,n):
        chg = 0
        for b in B:
            if abs(a[i]-a[b])<=k:
                B = [i]
                dp[i] = dp[b] + 1
                chg = 1
                continue
        if chg==0:
            dp[i] = dp[i-1]
            B.append(i)
    print(dp[-1])

if __name__ == "__main__":
    main()
