#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
ll n;
cin>>n;
ll k;cin>>k;
ll b[n];
for(ll i=0;i<n;i++){
cin>>b[i];
}
ll c = 0;
sort(b,b+n);
ll i=0,j=n-1;
while(i<j){
if(b[i]+b[j]>k){
j--;
}else{
c+=(j-i);
i++;
}
}
cout<<c;
return 0;
}//RRRRR
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CnR5cGVkZWYgbG9uZyBsb25nIGludCBsbDsKIAppbnQgbWFpbigpIHsKICAgIGxsIG47CiAgICBjaW4+Pm47CiAgICBsbCBrO2Npbj4+azsKICAgIGxsIGJbbl07CiAgICBmb3IobGwgaT0wO2k8bjtpKyspewogICAgICAgIGNpbj4+YltpXTsKICAgIH0KICAgIGxsIGMgPSAwOwogCiAKICAgIHNvcnQoYixiK24pOwogICAgbGwgaT0wLGo9bi0xOwogICAgd2hpbGUoaTxqKXsKICAgIAlpZihiW2ldK2Jbal0+ayl7CiAgICAJCWotLTsKICAgIAl9ZWxzZXsKICAgIAkJYys9KGotaSk7CiAgICAJCWkrKzsKICAgIAl9CiAgICB9CiAgICBjb3V0PDxjOwogICAgcmV0dXJuIDA7Cn0vL1JSUlJS