#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=998244353 ;

int main(){
	int n,y;
	cin>>n>>y;
	vector<ll> a(n);
	rep(i,n)cin>>a[i];
	ll sum=0;
	rep(i,n)sum+=a[i];
	sum/=5;
	ll ans = 0;
	rep(_,n){
		vector<vector<ll>> dp(n+1,vector<ll>(6,0));
		dp[0][0]=1;
		rep(i,n){
			ll cur = 0;
			for(int j=i;j>=0;--j){
				cur += a[j];
				if(cur+y>=sum){
					rep(k,5){
						dp[i+1][k+1]+=dp[j][k];
					}
				}
			}
		}
		ans +=dp[n][5];
		rotate(a.begin(),a.begin()+1,a.end());
	}
	cout<<ans/5<<endl;
	return 0;
}
