import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
String[] str = br.readLine().split("\\s+");
int n = Integer.parseInt(str[0]);
int k = Integer.parseInt(str[1]);
String[] numStr = br.readLine().split("\\s+");
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = Integer.parseInt(numStr[i]);
}
Arrays.sort(a);
long maxScore = 0;
int i = n - 1;// 从末尾开始遍历
// 从后往前贪心配对
while (i >= 1) {
if (a[i] - a[i - 1] <= k) {
maxScore += (long) a[i] * a[i - 1];
i -= 2;// 配对成功,跳过这两个元素
} else {
i -= 1;// 无法配对,只跳过当前元素
}
}
out.println(maxScore);
out.flush();
out.close();
br.close();
}
}