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:
# AGC038B
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))


from queue import deque
from collections import defaultdict
n, k = map(int, input().split())
p = list(map(int, input().split()))

count = 0
q = deque([])
maxq = deque([])
ren = 0
prev = -1
es = defaultdict(set)
slist = []
for i,num in enumerate(p):
    if i>=k:
        m = p[q[0]]
        M = p[maxq[0]]
        if num>M and m==p[i-k]:
            count += 1
            es[i-k].add(i-k+1)
            es[i-k+1].add(i-k)

    if prev<num:
        ren += 1
        prev = num
        if ren>=k-1:
            slist.append(i-k+1)
    else:
        ren = 0
        prev = num
    
    while q and p[q[-1]]>num:
        q.pop()
    q.append(i)
    if q[0]<=i-k:
        q.popleft()
    while maxq and p[maxq[-1]]<num:
        maxq.pop()
    maxq.append(i)
    if maxq[0]<=i-k:
        maxq.popleft()
if len(slist)>=2:
    for i in range(len(slist)-1):
        es[slist[i]].add(slist[i+1])
        es[slist[i+1]].add(slist[i])
ans = 0   
seen = [False] * n
for i in range(n-k+1):
    if seen[i]:
        continue
    ans += 1
    q = [i]
    seen[i] = True
    while q:
        u = q.pop()
        for v in es[u]:
            if not seen[v]:
                q.append(v)
                seen[v] = True
print(ans)