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; Array.Sort(A); var a = A.Where(value => value < x / 2).ToArray(); var b = A.Where(value => value >= x / 2).ToArray(); foreach(var m in a) { sum += b.Where(value => value + m == x).Count(); } if (x % 2 == 0) { var k = b.Where(value => value == x / 2).Count(); sum += k * k; } Console.WriteLine(sum); } } }