local ffi = require 'ffi' local C = ffi.C ffi.cdef 'int scanf(const char *, ...);' print((function (n, x, cd) local a,h,r={},{},0 for i=1,n do C.scanf("%d",cd) a[i]=cd[0] end for i=1,n do if h[a[i]]==nil then h[a[i]]=0 end h[a[i]]=h[a[i]]+1 end for i=1,n do if h[x-a[i]]~=nil then r=r+h[x-a[i]] end end return r end)(io.stdin:read("*n"), io.stdin:read("*n"), ffi.new("int[1]")))