Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/ochkoz-nuqtalarni-qoplash

Covering points with segments

Medium 1000 ms 128 MB 49%
Share

$n$ points are given on the number line: $x_{1}, x_{2}, \dots, x_{n}$ (some may coincide). You may take any number of segments of length $L$; the segment $[s; s + L]$ covers all points lying inside it or at its ends. What is the smallest number of segments needed to cover all the points?

Points on the number line and the equal-length segments covering them

Input

The first line contains two integers: $n$ and $L$. The second line contains $n$ space-separated integers $x_{i}$.

Output

One integer — the smallest number of segments.

Note

$1 \le n \le 10^{5}$
$0 \le L \le 10^{9}$
$-10^{9} \le x_{i} \le 10^{9}$

Examples

Input #1
5 2
9 1 5 2 6
Output #1
3
Input #2
3 0
4 4 4
Output #2
1

Sign in to submit a solution

Signing up is free and takes a minute.