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(); TreeMap map = new TreeMap<>(); for (int i = 0; i < n; i++) { int a = sc.nextInt(); if (map.containsKey(a)) { map.put(a, map.get(a) + 1); } else { map.put(a, 1); } } long total = 0; if (x % 2 == 0 && map.containsKey(x / 2)) { int sum = map.get(x / 2); total += (long)sum * sum; map.remove(x / 2); } int length = map.size(); int[] values = new int[length]; int[] counts = new int[length]; int idx = 0; for (Map.Entry entry : map.entrySet()) { values[idx] = entry.getKey(); counts[idx] = entry.getValue(); idx++; } int left = 0; int right = length - 1; while (left < right) { while (left < right && values[right] + values[left] > x) { right--; } if (values[right] + values[left] == x) { total += (long)counts[left] * counts[right] * 2; } left++; } System.out.println(total); } }