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 static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.max;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static class IntMaxTree {

		final int n;
		final int t[];

		IntMaxTree(int n) {
			this.n = n;
			t = new int[2 * n - 1];
		}

		void init(int v[]) {
			for (int i = 0; i < n; i++) {
				t[n - 1 + i] = v[i];
			}
			for (int i = n - 1; i != 0; i--) {
				t[i - 1] = max(t[(i << 1) - 1], t[i << 1]);
			}
		}

		int get(int i) {
			return t[i + n - 1];
		}

		int getMax(int l, int r) {
			int v = Integer.MIN_VALUE;
			for (l += n, r += n; l != r; l >>>= 1, r >>>= 1) {
				if ((l & 1) != 0) {
					v = max(v, t[l++ - 1]);
				}
				if ((r & 1) != 0) {
					v = max(v, t[--r - 1]);
				}
			}
			return v;
		}

		void set(int i, int v) {
			t[(i += n) - 1] = v;
			for (i >>= 1; i != 0; i >>= 1) {
				t[i - 1] = max(t[(i << 1) - 1], t[i << 1]);
			}
		}
	}

	static void solve() throws Exception {
		int n = scanInt(), k = scanInt();
		int p[] = new int[n];
		IntMaxTree minTree = new IntMaxTree(n), maxTree = new IntMaxTree(n);
		for (int i = 0; i < n; i++) {
			p[i] = scanInt();
			minTree.set(i, -p[i]);
			maxTree.set(i, p[i]);
		}
		int ans = 0;
		boolean haveSorted = false;
		int cntSorted = 0;
		for (int i = 0; i < n; i++) {
			if (i == 0 || p[i] > p[i - 1]) {
				++cntSorted;
			} else {
				cntSorted = 1;
			}
			if (i < k - 1) {
				continue;
			}
			if (cntSorted >= k) {
				if (!haveSorted) {
					haveSorted = true;
					++ans;
				}
			} else {
				if (i >= k) {
					int min = -minTree.getMax(i - k + 1, i),
						max = maxTree.getMax(i - k + 1, i);
					if (p[i] > max && p[i - k] < min) {
						continue;
					}
				}
				++ans;
			}
		}
		out.print(ans);
	}

	static int scanInt() throws IOException {
		return parseInt(scanString());
	}

	static long scanLong() throws IOException {
		return parseLong(scanString());
	}

	static String scanString() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}