#abld. [abl_d]Flat Subsequence
[abl_d]Flat Subsequence
Problem Statement
You are given a sequence and an integer .
Print the maximum possible length of a sequence that satisfies the following conditions:
- is a (not necessarily continuous) subsequence of .
- For each pair of adjacents elements of , the absolute difference of the elements is at most .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
10 3
1
5
4
3
8
6
9
7
2
4
Sample Output 1
7
For example, satisfies the conditions.
- It is a subsequence of .
- All of the absolute differences between two adjacent elements () are at most .