n, k = map(int, input().split())
a = list(map(int,input().split()))
a.sort(reverse = True)
sum = 0
i = 0
while i < n-1:
if a[i]- a[i+1]<=k:
sum += a[i]*a[i+1]
i += 2
else:
i += 1
print(sum)

n, k = map(int, input().split())
a = list(map(int,input().split()))
a.sort(reverse = True)
sum = 0
i = 0
while i < n-1:
if a[i]- a[i+1]<=k:
sum += a[i]*a[i+1]
i += 2
else:
i += 1
print(sum)