using System.Collections.Generic; using System; public class hello { public static void Main() { var d = new Dictionary(); string[] line = Console.ReadLine().Trim().Split(' '); var n = int.Parse(line[0]); var a = int.Parse(line[1]); line = Console.ReadLine().Trim().Split(' '); for (int i = 0; i < n; i++) { var w = int.Parse(line[i]); if (d.ContainsKey(w)) d[w]++; else d[w] = 1; } var ans = 0L; foreach (var x in d) { var s = a - x.Key; if (x.Key == s) ans++; else if (d.ContainsKey(s)) ans += x.Value * d[s]; } Console.WriteLine(ans); } }