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 JAVA):

Solution:
import java.io.*;
import java.util.*;

public class Main {
    class Reader {
        BufferedReader in;

        Reader() throws IOException {
            in = new BufferedReader(new InputStreamReader(System.in), 32768);
        }

        Reader(String name) throws IOException {
            in = new BufferedReader(new FileReader(name));
        }

        StringTokenizer tokin = new StringTokenizer("");

        String next() throws IOException {
            if (!tokin.hasMoreTokens()) {
                tokin = new StringTokenizer(in.readLine());
            }
            return tokin.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }
    }

    class Writer {
        PrintWriter cout;

        Writer() throws IOException {
            cout = new PrintWriter(System.out);
        }

        Writer(String name) throws IOException {
            cout = new PrintWriter(new FileWriter(name));
        }

        StringBuilder out = new StringBuilder();

        void print(Object a) {
            out.append(a);
        }

        void close() {
            cout.print(out.toString());
            cout.close();
        }
    }

    void solve() throws IOException {
        Reader in = new Reader();
        Writer out = new Writer();
        int n = in.nextInt();
        int k = in.nextInt();
        int p[] = new int[n];
        for (int i = 0; i < n; i++) {
            p[i] = in.nextInt();
        }
        TreeSet<Integer> t = new TreeSet<>();
        int ans = 0;
        int colInv = 0;
        for (int i = 1; i < k; i++) {
            if (p[i - 1] > p[i]) {
                colInv++;
            }
            t.add(p[i]);
        }
        if (colInv > 0) {
            ans++;
        }
        boolean not = false;
        if (colInv == 0) {
            not = true;
        }
        for (int i = k; i < n; i++) {
            if (p[i - k] > p[i - k + 1]) {
                colInv--;
            }
            t.remove(p[i - k]);
            boolean can = !(t.lower(p[i - k]) == null && t.higher(p[i]) == null);
            if (p[i - 1] > p[i]) {
                colInv++;
            }
            if (can && colInv > 0) {
                ans++;
            }
            t.add(p[i]);
            if (colInv == 0) {
                not = true;
            }
        }
        if (not) {
            ans++;
        }
        out.print(ans);
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new Main().solve();
    }
}