using System; using System.Collections.Generic; using System.Linq; namespace yukicoder { public class Program { public static void Main() { var line = Console.ReadLine().Split(' '); var n = int.Parse(line[0]); var x = int.Parse(line[1]); var a = Console.ReadLine().Split(' ').Select(value => int.Parse(value)).ToArray(); var sum = 0; var c = new bool[n]; Array.Sort(a); var t = 0; for(var i = 0; i < n; i++) { if (x % 2 == 0 && a[i] == x / 2) { t++; } else if(!c[i]) { for (var j = n - 1; j >= 0; j--) { if (a[i] + a[j] == x) { c[j] = true; sum += 2; } else if (a[i] + a[j] < x) { break; } } } c[i] = true; } sum += t * t; Console.WriteLine(sum); } } }