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 = long.Parse(line[0]); var x = long.Parse(line[1]); var a = Console.ReadLine().Split(' ').Select(value => int.Parse(value)).ToArray(); long sum = 0; var T = x % 2 == 0; Array.Sort(a); long t = 0; for(var i = 0; i < n; i++) { if ( T && a[i] == x / 2) { t++; } else { if (a[i] > x / 2) { break; } for (var j = n - 1; j >= 0; j--) { if (a[i] + a[j] == x) { sum += 2; } else if (a[i] + a[j] < x) { break; } } } } sum += t * t; Console.WriteLine(sum); } } }