n,k=map(int,input().split()) a=[int(x) for x in input().split()] d=0 for i in range(n): j=i+1 while j<n: if a[i]+a[j]==k: d+=1 j+=1 else: j+=1 print(d)