#abc376a. A - Candy Button

A - Candy Button

Score : 150150 points

问题陈述

有一个神秘的按钮。当你按下这个按钮时,你会得到一颗糖果,除非你距离上次得到糖果的时间还不到 CC 秒。

高桥决定按下这个按钮 NN 次。他将在从现在开始的 TiT_i 秒时按下第 ii 次按钮。

他将得到多少颗糖果?

以上为大语言模型 kimi 翻译,仅供参考。

Problem Statement

There is a mysterious button. When you press this button, you receive one candy, unless less than CC seconds have elapsed since you last received a candy.

Takahashi decided to press this button NN times. He will press the button for the ii-th time TiT_i seconds from now.

How many candies will he receive?

Constraints

  • 1N1001 \leq N \leq 100
  • 1C10001 \leq C \leq 1000
  • 0T1<T2<<TN10000 \leq T_1 < T_2 < \dots < T_N \leq 1000
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

NN CC

T1T_1 T2T_2 \dots TNT_N

Output

Print the number of candies that Takahashi will receive.

Sample Input 1

6 5
1 3 7 8 10 12

Sample Output 1

3

Takahashi will press the button six times.

  • 1st press (11 second from now): You always receive a candy when pressing the button for the first time.
  • 2nd press (33 seconds from now): 31=2<C3 - 1 = 2 < C seconds have elapsed since he last received a candy, so he does not receive a candy.
  • 3rd press (77 seconds from now): 71=6C7 - 1 = 6 \geq C seconds have elapsed since he last received a candy, so he receives a candy.
  • 4th press (88 seconds from now): 87=1<C8 - 7 = 1 < C second has elapsed since he last received a candy, so he does not receive a candy.
  • 5th press (1010 seconds from now): 107=3<C10 - 7 = 3 < C seconds have elapsed since he last received a candy, so he does not receive a candy.
  • 6th press (1212 seconds from now): 127=5C12 - 7 = 5 \geq C seconds have elapsed since he last received a candy, so he receives a candy.

Therefore, he receives three candies.

Sample Input 2

3 2
0 2 4

Sample Output 2

3

Sample Input 3

10 3
0 3 4 6 9 12 15 17 19 20

Sample Output 3

7