Kiran's Cool CollectionsMedium

Kiran's Cool Collections

Medium+30 XP · +10 Aurahash maptwo pointers

Kiran is an avid collector of unique trinkets. He has a large box filled with items, each with a specific integer 'coolness' value. He wants to find the largest possible number of pairs of items where the sum of their coolness values is exactly K. Each item can only be used in at most one pair. Help Kiran find this maximum number of pairs!

Input

The first line contains two integers N and K, the number of items and the target sum. The second line contains N integers, the coolness values of the items.

Output

Print a single integer, the maximum number of pairs that sum to K.

Constraints

1 <= N <= 200000, 1 <= K <= 200000, 0 <= coolness_value <= 200000

Time limit 1 s (native code; slower languages get more)Memory 256 MB15 hidden tests

Example 1

Input
5 10
1 9 5 5 5
Output
2

Pairs are (1,9) and (5,5). Max 2 pairs.

Example 2

Input
6 8
2 6 2 6 4 4
Output
3

Pairs are (2,6), (2,6), (4,4). Max 3 pairs.

Hints