/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		int size = sc.nextInt();
 		
		int[] arr =new int[size];

		int target = sc.nextInt();
 
		for(int i = 0;i<size;i++){
			arr[i] = sc.nextInt();
		}

	
 
            int result = countPairs(arr,target);
            System.out.println(result);
        
	}

    public  static int countPairs(int arr[], int target) {
        // code here
        Map<Integer,Integer> map = new HashMap<>();
        
        int count = 0;
        for(int num : arr){
            
            int complement = target - num;
            
            if(map.containsKey(complement)){
                
                count+=map.get(complement);
                
            }
            map.put(num,map.getOrDefault(num,0)+1);
        }
        
        return count;
        
    }

}