#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int n,target;
	cin>>n>>target;
	int arr[n];
	for(int i = 0; i < n; i++){
		cin>>arr[i];
	}
	unordered_map<int,int> ump;
	
	int cnt = 0;
	
	for(int j = 0; j < n; j++){
		int r = target - arr[j];
		
		//Here ump[r] tells us the frequency of targer-arr[j] in the left side of j
		
		if(ump.count(r)){
			cnt += ump[r];
		}
		
		ump[arr[j]]++;
	}
	cout<<cnt<<endl;
	return 0;
}