open System let solve (a: int array) x = let count = a |> Array.countBy id let countKey = count |> Array.map fst let countMap = count |> Map.ofArray let pairNum key1 = let val1 = countMap.[key1] let key2 = x - key1 Map.tryFind key2 countMap |> function | Some val2 -> val1 * val2 | None -> 0 countKey |> Array.map pairNum |> Array.sum let R () = Console.ReadLine().Split() |> Array.map int let N, X = let t = R () t.[0], t.[1] let a = R() solve a X |> Console.WriteLine