// Starcraft 2 enjoyer //
#include <bits/stdc++.h>
// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
using namespace std;
#define LSOne(X) ((X) & -(X))
const int N = 1e2 + 5;
const int M = 2e5 + 5;
const int O = 1e5 + 5;
const int LG = 20;
const int INF = 1e9 + 5;
const int B = 1000;
const int MOD = 1e9 + 7;
int n, l, a[N], ans;
vector<int> v;
void chk()
{
int i = 0;
for (int x = 0; x < n - 1; x++)
{
i += abs(a[v[x]] - a[v[x + 1]]);
}
ans += i <= l;
}
inline void solve()
{
cin >> n >> l;
for (int x = 1; x <= n; x++)
{
cin >> a[x];
v.push_back(x);
}
chk();
while (next_permutation(v.begin(), v.end()))
{
chk();
}
cout << ans << "\n";
}
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin >> t;
for (int x = 1; x <= t; x++)
{
solve();
}
return 0;
}