#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 4000000000000000000 //オーバーフローに注意
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define SIZE 55

ll A[SIZE],maxi[SIZE];
ll dp[SIZE][2];

int main(){

	ll N,price;
	scanf("%lld %lld",&N,&price);

	for(ll i = 1; i <= N; i++){

		scanf("%lld",&A[i]);
	}

	maxi[N] = HUGE_NUM;
	for(ll i = N-1; i >= 1; i--){

		maxi[i] = A[i+1]/A[i]-1; //その硬貨を払える最大枚数
	}

	stack<ll> S;

	ll tmp = price;

	for(ll i = N; i >= 1; i--){

		if(A[i] <= tmp){

			ll work = tmp/A[i];
			S.push(work);
			tmp %= A[i];

		}else{

			S.push(0);
		}
	}

	for(int digit = 0; digit <= N; digit++){
		for(int is_up = 0; is_up <= 1; is_up++){

			dp[digit][is_up] = 0;
		}
	}

	dp[0][0] = 1; //dp[桁][繰り上がりの有無] := 場合の数

	for(ll digit = 1; digit <= N; digit++){

		ll x = S.top();
		S.pop();

		for(ll pre_up = 0; pre_up <= 1; pre_up++){
			if(dp[digit-1][pre_up] == 0)continue;

			/*おつりと支払いが両方0*/
			if((pre_up == 0 && x == 0) || (pre_up == 1 && x+pre_up == maxi[digit]+1)){

				if(pre_up == 0 && x == 0){

					dp[digit][0] += dp[digit-1][pre_up];

				}else{

					dp[digit][1] += dp[digit-1][pre_up];
				}
			}

			/*おつりが0で支払いが非0*/
			if((pre_up+x > 0 && pre_up+x != maxi[digit]+1)){

				dp[digit][0] += dp[digit-1][pre_up];
			}

			/*おつりが非0で支払いが0→必ず繰り上がり*/
			if(pre_up+x > 0 && pre_up+x <= maxi[digit]){

				dp[digit][1] += dp[digit-1][pre_up];
			}
		}
	}

	printf("%lld\n",dp[N][0]);

	return 0;
}

// Problem: Blocks on Grid
// Date:

#include<bits/stdc++.h>
using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef unsigned long long ull;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	int n,m;
	int a[101][101];
	cin >> n >> m;
	int minn=101;
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j){
			cin >> a[i][j];
			if (a[i][j] < minn)
				minn=a[i][j];
		}
	int res=0;
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j)
			if(a[i][j] > minn)
				res+=a[i][j] - minn;
	cout << res;
	return 0;
}