#include #include #include using namespace std; template bool maxPointer(T& a, T b) { if (a < b) {a = b;return true;}return false;} template int maxReturn(T a, T b) {if (a > b) {return a;} else {return b;}} template bool minPointer(T& a, T b) {if (a < b) {a = b;return true;}return false;} int main(void){ int N; long X; cin >> N >> X; int aCount[1000001] = {}; int a[N]; int count = 0; for (int i = 0; i < N; i++) { int tmp; cin >> tmp; a[i] = tmp; aCount[tmp]++; } for (int i = 1; i <= N; i++) { int target = X - a[i-1]; if (target < 0) continue; count += aCount[target]; } cout << count << endl; }