#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int size,k;
    cin>>size>>k;
    int A[size];
    for(int i = 0 ; i<size ; i++){
    	cin>>A[i];
    }
    map<int,int>hashmap;
    for(int i = 0 ; i<size ; i++){
    	hashmap[A[i]]++;
    }
    int totalCount = 0;
    if(k%2==0){
    		int d = k/2;
    		if(hashmap.find(d)!=hashmap.end()){
    			totalCount += (hashmap[d]*((hashmap[d])-1))/2;
    		}
    	}
    for(auto i : hashmap){
        if(i.first<(k/2)){
    	if(hashmap.find((k-i.first))!=hashmap.end()){
            int d = i.second;
    		int e = hashmap[(k-i.first)];
    		totalCount += (d*e);
    	}
       }
    }
    cout<<totalCount<<endl;
}