print((function (fh) local a,h,r,n,x={},{},0,fh:read("*n"),fh:read("*n") for i=1,n do a[i]=fh:read("*n") 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))