fun main(args:Array) { val (n, x) = readLine()!!.split(" ").map(String::toInt) val xs = readLine()!!.split(" ").map(String::toInt) val freq = xs.groupBy { it }.map { (k,vs) -> Pair(k, vs.size) }.toMap() val sets = xs.toSet() val keys = mutableListOf>() for( s in sets.toList() ) { if( sets.contains(x-s) ) keys.add( Pair(s, x-s) ) } keys.toList().map { (k, v) -> freq[k]!!*freq[v]!! }.sum().run(::println) }