10209: 中位数

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:1 Solved:0

Description

给出1~n的一个排列,统计该排列有多少个长度为奇数的连续子序列的中位数是b。中位数是指把所有元素从小到大排列后,位于中间的数。

Input

第一行为两个正整数n和b ,第二行为1~n 的排列。

Output

输出一个整数,即中位数为b的连续子序列个数。

Sample Input Copy

Input 1:
5 4
1 2 3 4 5

Input 2:
6 3
1 2 4 5 6 3

Input 3:
7 4
5 7 2 4 3 1 6

Sample Output Copy

Output 1:
2

Output 2:
1

Output 3:
4