import java.util.Scanner; public class Main { public static void main(String[] args) { new Main().run(); } void run() { Scanner sc = new Scanner(System.in); int[] cnt = new int[1000001]; int n = sc.nextInt(); int x = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; ++i) { a[i] = sc.nextInt(); cnt[a[i]]++; } long ans = 0; for (int i = 0; i < n; ++i) { if (x - a[i] < 0 || x - a[i] >= cnt.length) continue; ans += cnt[x - a[i]]; } System.out.println(ans); } }