提示: 欢迎访问OurACM平台。
Problem 2058 Another a+b

Accept: 233    Submit: 1146
Time Limit: 1000 mSec    Memory Limit : 32768 KB

Problem Description

A array contain N number, can you tell me how many different pair i,j that satisfy a[i] + a[j] = M and 1<=i < j <=N.

Input

There are multiple tests,

each test first line contain two integer numbers N M, second line contain N integer numbers.

0 < N <= 100000, 0 <= M <= 1000000000, -1000000000 <= a[i] <= 1000000000

Output

Each test output how many different pair i,j that satisfy a[i] + a[j] = M and 1<=i < j <=N .

Sample Input

3 2 1 1 1 5 5 1 2 3 4 5

Sample Output

3 2

Source

FOJ有奖月赛-2011年11月

Submit  Back  Status  Discuss