n, k = map(int, input().split(' '))
nums = []
for _ in range(n):
  nums.append(int(input()))
a = [[0]]
    
for i in range(1, n):
  flag = 0
  for j in range(len(a) - 1, -1, -1):
    if flag == 0:
      for b in a[j]:
        if abs(nums[i] - nums[b]) <= k:
          flag = 1
          if j + 1 == len(a):
            a.append([i])
          else:
            a[j + 1].append(i)
          continue
  if flag == 0:
    a[0].append(i)
      
print(len(a))