#include <bits/stdc++.h>
using namespace std;
int const NMAX = 1e5;
int const MMAX = 1e6;
int n, s;
int freq[1 + MMAX];
int pre[1 + MMAX];
int main() {
cin >> n >> s;
int selfPairs = 0;
for(int i = 1; i <= n; i++) {
int x; cin >> x;
freq[x]++;
if(2*x <= s) selfPairs++;
}
for(int i = 1; i <= MMAX; i++) {
pre[i] = pre[i-1] + freq[i];
}
int ans = 0;
for(int i = 1; i <= s; i++) {
ans += freq[i] * pre[s-i];
}
ans -= selfPairs;
ans /= 2;
cout << ans << "\n";
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IGNvbnN0IE5NQVggPSAxZTU7CmludCBjb25zdCBNTUFYID0gMWU2OwppbnQgbiwgczsKaW50IGZyZXFbMSArIE1NQVhdOwppbnQgcHJlWzEgKyBNTUFYXTsKCmludCBtYWluKCkgewogICAgY2luID4+IG4gPj4gczsKICAgIGludCBzZWxmUGFpcnMgPSAwOwogICAgZm9yKGludCBpID0gMTsgaSA8PSBuOyBpKyspIHsKICAgICAgICBpbnQgeDsgY2luID4+IHg7CiAgICAgICAgZnJlcVt4XSsrOwogICAgICAgIGlmKDIqeCA8PSBzKSBzZWxmUGFpcnMrKzsKICAgIH0KICAgIGZvcihpbnQgaSA9IDE7IGkgPD0gTU1BWDsgaSsrKSB7CiAgICAgICAgcHJlW2ldID0gcHJlW2ktMV0gKyBmcmVxW2ldOwogICAgfQogICAgaW50IGFucyA9IDA7CiAgICBmb3IoaW50IGkgPSAxOyBpIDw9IHM7IGkrKykgewogICAgICAgIGFucyArPSBmcmVxW2ldICogcHJlW3MtaV07CiAgICB9CiAgICBhbnMgLT0gc2VsZlBhaXJzOwogICAgYW5zIC89IDI7CiAgICBjb3V0IDw8IGFucyA8PCAiXG4iOwp9