# your code goes here
n=int(input())
target=int(input())
arr=list(map(int, input().split()))
hashmap={}
ctr=0
for x in arr:
req=target-x
if req in hashmap:
ctr+=hashmap[req]
hashmap[x]=hashmap.get(x, 0)+1
print(ctr)
IyB5b3VyIGNvZGUgZ29lcyBoZXJlCm49aW50KGlucHV0KCkpCnRhcmdldD1pbnQoaW5wdXQoKSkKYXJyPWxpc3QobWFwKGludCwgaW5wdXQoKS5zcGxpdCgpKSkKaGFzaG1hcD17fQpjdHI9MApmb3IgeCBpbiBhcnI6CglyZXE9dGFyZ2V0LXgKCWlmIHJlcSBpbiBoYXNobWFwOgoJCWN0cis9aGFzaG1hcFtyZXFdCgloYXNobWFwW3hdPWhhc2htYXAuZ2V0KHgsIDApKzEKcHJpbnQoY3RyKQo=