import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int x = sc.nextInt(); int[] a = new int[n]; int[] num = new int[100001]; for(int i = 0; i < n; i++) { int t = sc.nextInt(); a[i] = t; num[t]++; } long ans = 0; for(int i = 0; i < n; i++) { if(((x - a[i]) >= 0) && ((x - a[i]) <= 100000)) ans += num[x - a[i]]; } System.out.println(ans); } }