#876
Gold II
SREDNJI
시간 제한
1s
메모리 제한
32MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Consider a sequence A of integers, containing N integers between 1 and N. Each integer appears exactly once in the sequence. A subsequence of A is a sequence obtained by removing some (possibly none) numbers from the beginning of A, and then from the end of A. Calculate how many different subsequences of A of odd length have their median equal to B. The median of a sequence is the element in the middle of the sequence after it is sorted. For example, the median of the sequence {5, 1, 3} is 3.

입력

The first line contains two integers, N (1 ≤ N ≤ 100 000) and B (1 ≤ B ≤ N). The second line contains N integers separated by spaces, the elements of sequence A.

출력

Output the number of subsequences of A whose median is B.

예제 입력 1

5 4
1 2 3 4 5

예제 출력 1

2

예제 입력 2

6 3
1 2 4 5 6 3

예제 출력 2

1

예제 입력 3

7 4
5 7 2 4 3 1 6

예제 출력 3

4
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Gold II1명 투표· 약 1개월 전
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.