#include<cstdio>
#include<algorithm>
using namespace std;
const int Maxn = 2e4;
//binarysearch水题
int main()
{
    int n,s;
    int num[Maxn+5];
    scanf("%d%d",&n,&s);
    for(int i = 0; i<n; ++i)
        scanf("%d",&num[i]);
    sort(num,num+n);
    int ans = 0;
    for(int i = 0; i<n; ++i)
    {
        ans += upper_bound(num+i+1,num+n,s-num[i])-(num+i+1);
    }
    printf("%d\n",ans);
    return 0;
}