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 _=1,n do C.scanf("%d",cd) if h[cd[0]]==nil then h[cd[0]]=0 end h[cd[0]]=h[cd[0]]+1 end for k,_ in pairs(h) do table.insert(a,k) end table.sort(a) for i=1,#a do if a[i]*2==x then r=r+h[a[i]] goto bot end for j=i+1,#a do local t=a[i]+a[j] if t>x then break end if t==x then r=r+h[a[i]]*h[a[j]]*2 end end ::bot:: end return r end)(io.stdin:read("*n"), io.stdin:read("*n"), ffi.new("int[1]")))