n,m=map(int,input().split()) l=list(map(int,input().split())) from collections import Counter c=Counter(l) ans=0 for x in l: if m-x==x: ans+=c[x] else: ans+=c[m-x] print(ans)