func main() var n: int :: cui@inputInt() var x: int :: cui@inputInt() var mp: dict :: #dict for i(0, n - 1) var a: int :: cui@inputInt() do mp.add(a, mp.get(a, &) + 1) end for var keys: []int block var keyList: List :: #List class List() +var li: list *func ctor() do me.li :: #list end func end class do mp.forEach(callback, keyList $ kuin@Class) func callback(key: int, value: int, data: kuin@Class): bool do(data $ List).li.add(key) ret true end func do keys :: keyList.li.toArray() end block var ans: int :: 0 for i(0, ^keys - 1) var k: int :: keys[i] var a: int :: x - k var nk: int :: mp.get(k, &) var na: int :: mp.get(a, &) do ans :+ nk * na end for do cui@print("\{ans}\n") end func