#K35457. Count Unique Pairs with Sum

    ID: 25535 Type: Default 1000ms 256MiB

Count Unique Pairs with Sum

Count Unique Pairs with Sum

You are given a list of integers and an integer k. Your task is to count the number of unique pairs in the list whose sum is equal to k. A pair is considered unique if it consists of two distinct elements from the list and each pair is counted only once. Use \( \texttt{stdin} \) for input and \( \texttt{stdout} \) for output.

Note: The order of the numbers in a pair does not matter, and each valid pair should be counted only once.

Example:

Input:
5 9
2 7 11 15 1

Output: 1

</p>

inputFormat

The first line contains two integers \( n \) and \( k \), where \( n \) is the number of elements in the list and \( k \) is the target sum.

The second line contains \( n \) space-separated integers representing the list.

outputFormat

Output a single integer representing the number of unique pairs that add up to \( k \).

## sample
5 9
2 7 11 15 1
1