#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
	int*p,n,s,r,a[20000],i;
	while(scanf("%d%d",&n,&s),n)
	{
		for(i=0;i<n;++i)scanf("%d",a+i);
		sort(a,a+n);
		for(r=i=0;i<n;++i)
		{
			p=lower_bound(a+i+1,a+n,s-a[i]+1);
			if(p-a-n)
				r+=a+n-p;
		}
		printf("%d\n",r);
	}
	return 0;
}