#include <cstdio>
using namespace std;
int n,k,c=0,a[10];
bool used[10]={true};
int absint(int a)
{
if (a<0)
return(-a);
else
return(a);
}
void tryit(int deep,int pos,int last)
{
if (absint(a[pos]-a[last])>k)
return;
if (deep==n)
{
if (absint(a[pos]-a[0])<=k)
c++;
return;
}
used[pos]=true;
int i;
for (i=1;i<n;i++)
if (!used[i])
tryit(deep+1,i,pos);
used[pos]=false;
}
int main(void)
{
freopen("round.in","r",stdin);
freopen("round.out","w",stdout);
int i;
scanf("%d %d\n",&n,&k);
if (n==1)
{
printf("1\n");
fclose(stdin);
fclose(stdout);
return(0);
}
for (i=0;i<n;i++)
scanf("%d\n",&a[i]);
for (i=1;i<n;i++)
tryit(2,i,0);
printf("%d\n",c);
fclose(stdin);
fclose(stdout);
return(0);
}