#include <bits/stdc++.h>

#define fo(i, x, y) for (int i = x; i <= (y); ++i)
#define fd(i, x, y) for (int i = x; i >= (y); --i)
using namespace std;

typedef long long ll;

const int maxn = 50 + 5;

int n;
ll X;
ll a[maxn], b[maxn], g[maxn];
ll f[maxn][2];

int getint()
{
	char ch;
	int res = 0, p;
	while (!isdigit(ch = getchar()) && ch != '-');
	p = ch == '-'? ch = getchar(), -1 : 1;
	while (isdigit(ch))
		res = res * 10 + ch - '0', ch = getchar();
	return res * p;
}

int main()
{
	n = getint(); scanf("%lld", &X);
	fo(i, 1, n) scanf("%lld", &a[i]);
	fo(i, 1, n - 1) b[i] = a[i + 1] / a[i];
	b[n] = (X - 1) / a[n] + 1 + 10;
	fd(i, n, 1) g[i] = X / a[i], X %= a[i];
	f[0][0] = 1;
	fo(i, 1, n)
	{
		// k = 0
		f[i][0] += f[i - 1][0];
		if (g[i] < b[i] - 1) f[i][0] += f[i - 1][1];
		else f[i][1] += f[i - 1][1];
		//k > 0
		if (g[i] < b[i] - 1) f[i][1] += f[i - 1][1];
		if (g[i] > 0) f[i][1] += f[i - 1][0];
	}
	printf("%lld\n", f[n][0]);
	return 0;
}

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define pii pair<int,int> 
#define int long long
const int MOD=1e9+7;
const int N=3e5+10;
void solve()
{
	int n;
	cin>>n;
	vector<int>a(n);
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	int mp[500]={0};
	int ans=0;
	for(int i=0;i<n;i++)
	{
		for(int j=-200;j<=200;j++)
		{
			ans+=mp[j+200]*((a[i]-j)*(a[i]-j));
		}
		mp[a[i]+200]++;
	}
	cout<<ans<<endl;
}
int32_t main()
{
	IOS;
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
}