#include
using namespace std;
int b[150001];
int main() {
long long n, c, t = 0;
scanf("%d %d", &n, &c);
for (int i = 1; i <= n; i++) cin >> b[i];
for (int i = 1; i <= n; i++) {
for (int j = 2; j <= n; j++) {
if (b[j] - b[i] == c)
t++;
}
}
printf("%d", t);
return 0;
}
1153怎么超时了???????