import std.experimental.all; T read(T)() { return readln.chomp.to!T; } T[] reads(T)() { return readln.split.to!(T[]); } alias readint = read!int; alias readints = reads!int; long calc(int x, int[] a) { auto freq = new int[](a.maxElement + 1); foreach (e; a) freq[e]++; long ans = 0; foreach (e; a) { int y = x - e; if (0 <= y && y < freq.length) ans += freq[y]; } return ans; } void main() { auto nx = readints; int x = nx[1]; auto a = readints; writeln(calc(x, a)); }