java
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int c = sc.nextInt();
int[] res = new int[n+1];
for(int i=1;i<=n;i++)
res[i] = sc.nextInt();
int sum = 0;
for(int i=1;i<=n;i++) {
for(int j=1;j<=n;j++) {
if((res[i]-res[j]) == c) {
sum++;
}
}
}
System.out.println(sum);
}
}