P26934 [AtCoder] Occurrence Count
提高-
题目描述

Problem Description

You are given an integer sequence \( A = (A_1, A_2, \ldots, A_N) \) of length \( N \). How many times does the integer \( X \) appear in this sequence?

Input Format

The input is given from the standard input in the following format:

\( N \) \( X \) \( A_1 \) \( A_2 \) \( \ldots \) \( A_N \)

Output Format

Output the number of occurrences of the integer \( X \) in the sequence \( A \), i.e., the number of \( i \) such that \( A_i = X \).

Sample Input and Output

Sample Input #1

3 3
2 3 3

Sample Output #1

2

Sample Input #2

3 1
2 3 3

Sample Output #2

0

Sample Input #3

5 2
2 3 4 2 2

Sample Output #3

3

Notes/Hints

Constraints

  • \( 1 \leq N \leq 10^5 \)
  • \( 1 \leq X \leq 10^9 \)
  • \( 1 \leq A_i \leq 10^9 \)
  • All inputs are integers.

Sample Explanation 1

The integer \( 3 \) appears \( 2 \) times in the sequence \( A \).

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 3 2 3 3
样例输出
2