using System; using System.IO; using System.Linq; using System.Collections.Generic; using System.Text; public class Program { public void Proc() { long[] inpt = Reader.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray(); long total = inpt[1]; long[] items = Reader.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray(); Dictionary dic = new Dictionary(); foreach(long item in items) { if(dic.ContainsKey(item)) { dic[item]++; } else { dic[item] = 1; } } long ans = 0; foreach(long key in dic.Keys) { long pairKey = total - key; if(pairKey<0) { continue; } if(!dic.ContainsKey(pairKey)) { continue; } ans += (long)dic[key] * (long)dic[pairKey]; } Console.WriteLine(ans); } private int[] GetIntArray() { return Reader.ReadLine().Trim().Split(' ').Select(a => int.Parse(a)).ToArray(); } public class Reader { static StringReader sr; public static bool IsDebug = false; public static string ReadLine() { if (IsDebug) { if (sr == null) { sr = new StringReader(InputText.Trim()); } return sr.ReadLine(); } else { return Console.ReadLine(); } } private static string InputText = @" "; } public static void Main(string[] args) { #if DEBUG Reader.IsDebug = true; #endif Program prg = new Program(); prg.Proc(); } }