#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(){
	int N,K; 
	cin >> N >> K;
	vector<vector<int>> T(N,vector<int>(N));

	for(int i=0; i<N; i++){
		for(int j=0; j<N; j++){
			cin >> T[i][j];
		}
	}

	vector<int> town = {1,2,3,4,5,6,7};
	int ans = 0;
	do{
		int cnt = 0;
		cnt = T[0][town[0]];
		for(int i=1; i<N-1; i++){
			cnt += T[town[i-1]][town[i]];
		}
		cnt += T[town[N-2]][0];
		if(cnt == K) ans++;
	}while(next_permutation(town.begin(),town.begin()+N-1));

	cout << ans << endl;

	return 0;
}
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
using lint=long long;
#define debug(output) cout<<#output<<"= "<<output<<endl
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  lint n,x;cin>>n>>x;
  vector<lint> a(n);
  rep(i,n)cin>>a[i];
  a.push_back(((x/a[n-1])+2)*a[n-1]);
  vector<lint> dp(2,0);
  dp[0]=1;
  rep(i,n){
      vector<lint> nxt(2,0);
      lint d=x%a[i+1];
      d/=a[i];
      if(d==0){
          nxt[1]=dp[1];
      }
      else{
          nxt[1]=dp[1]+dp[0];
      }
      if(d==a[i+1]/a[i]-1){
          nxt[0]=dp[0];
      }
      else{
          nxt[0]=dp[1]+dp[0];
      }
      swap(dp,nxt);
  }
  cout<<dp[0]<<"\n";
  return 0;
}