Problem: Snuke has a permutation (P_0,P_1,\cdots,P_{N-1}) of (0,1,\cdots,N-1).

Now, he will perform the following operation exactly once:

* Choose K consecutive elements in P and sort them in ascending order.



Find the number of permutations that can be produced as P after the operation.

Constraints

* 2 \leq N \leq 200000
* 2 \leq K \leq N
* 0 \leq P_i \leq N-1
* P_0,P_1,\cdots,P_{N-1} are all different.
* All values in input are integers.

Input

Input is given from Standard Input in the following format:


N K
P_0 P_1 \cdots P_{N-1}


Output

Print the number of permutations that can be produced as P after the operation.

Examples

Input

5 3
0 2 1 4 3


Output

2


Input

4 4
0 1 2 3


Output

1


Input

10 4
2 0 1 3 7 5 4 6 8 9


Output

6

Solution (in PYTHON3):

Solution:
import sys
from collections import deque
from bisect import bisect_left
input = sys.stdin.buffer.readline

N, K = map(int, input().split())
Ps = list(map(int, input().split()))

downs = []
for i in range(N-1):
    if Ps[i+1] < Ps[i]:
        downs.append(i)

if not downs:
    print(1)
    exit()

min_wait = deque()
max_wait = deque()
for i in range(K):
    while min_wait and min_wait[-1] > Ps[i]:
        min_wait.pop()
    min_wait.append(Ps[i])
    while max_wait and max_wait[-1] < Ps[i]:
        max_wait.pop()
    max_wait.append(Ps[i])
    
change_nothing = (downs[0] >= K-1)
if change_nothing:
    ans = 0
else:
    ans = 1
    
for i in range(K, N):
    while min_wait and min_wait[-1] > Ps[i]:
        min_wait.pop()
    min_wait.append(Ps[i])
    while max_wait and max_wait[-1] < Ps[i]:
        max_wait.pop()
    max_wait.append(Ps[i])

    if min_wait[0] != Ps[i-K] or max_wait[0] != Ps[i]:
        t = bisect_left(downs, i-K+1)
        if t < len(downs):
            if downs[t] >= i:
                change_nothing = True
            else:
                ans += 1
        else:
            if downs[-1] + K < N:
                change_nothing = True
            break
    
    if min_wait[0] == Ps[i-K]:
        min_wait.popleft()
    if max_wait[0] == Ps[i-K]:
        max_wait.popleft()


if change_nothing:
    ans += 1

print(ans)