/*
    _________             ____    __   __    __      __       __       __   __  
   |___   ___|           /  __)  |  | |  |  |  \    /  |     /  \     |  \ |  | 
       | |     __       (  {__   |  | |  |  |   \  /   |    / /\ \    |   \|  | 
       | |    /__\       \__  \  |  |_|  |  |    \/    |   / ____ \   |       | 
       | |                __)  ) {       }  |  |\__/|  |  / /    \ \  |  |\   | 
       |_|               (____/   \_____/   |__|    |__| /_/      \_\ |__| \__| 
*/
#include<bits/stdc++.h>
#define t_suman ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long int
#define pll pair<ll,ll>
#define VP vector< pll >
#define VLL vector< ll >
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(int (i) = (a); (i) < (b); (i)++)
#define rrep(i,a,b) for(int (i) = (a); (i) > (b); (i)--)
#define all(v) (v).begin(),(v).end()
#define FF first
#define SS second
#define in insert
#define out erase
#define MOD 1000000007
#define MAX 1000005
using namespace std;

bool compare(const pair<ll,ll>& a , const pair<ll,ll>& b){
    return a.first<b.first;
}

ll gcd(ll a, ll b){ 
    if (a == 0) return b; 
    return gcd(b % a, a); 
}
ll power(ll x, unsigned ll y){ 
    int res = 1; 
   
    while(y>0){  
        if (y & 1) res = res*x; 
   
        y = y>>1;
        x = x*x;
    } 
    return res; 
}
ll digSum(ll n){
	return n==0 ? 0 : (n%10)+digSum(n/10);
}
ll digMul(ll n){
	return n==0 ? 0 : (n%10)*digSum(n/10);
}
ll countNumberOfDigs(ll n){
	if(n==0)return 1;
	ll count=0;
	while(n!=0){
		n/=10;
		count++;
	}
	return count;
}
bool isPrime(ll n){ 
    if (n <= 1) return false; 
    if (n <= 3) return true;
    if (n % 2 == 0 || n % 3 == 0) return false; 
  
    for (ll i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
}
void allPrime(map<ll,bool>& m){
	vector<bool> ar(MAX,1);
	ar[0]=0,ar[1]=0;
	rep(i,2,MAX){
		if(ar[i]){
			for(int j=2;i*j<MAX;j++){
				ar[i*j]=0;
			}
		}
	}
	rep(i,2,MAX){
		if(ar[i]){
			m[i]=1;
		}
	}
}
ll printNcR(ll n, ll r) 
{ 
  
    // p holds the value of n*(n-1)*(n-2)..., 
    // k holds the value of r*(r-1)... 
    long long p = 1, k = 1; 
  
    // C(n, r) == C(n, n-r), 
    // choosing the smaller value 
    if (n - r < r) 
        r = n - r; 
  
    if (r != 0) { 
        while (r) { 
            p *= n; 
            k *= r; 
  
            // gcd of p, k 
            long long m = __gcd(p, k); 
  
            // dividing by gcd, to simplify product 
            // division by their gcd saves from the overflow 
            p /= m; 
            k /= m; 
  
            n--; 
            r--; 
        } 
  
        // k should be simplified to 1 
        // as C(n, r) is a natural number 
        // (denominator should be 1 ) . 
    } 
  
    else
        p = 1; 
  
    // if our approach is correct p = ans and k =1 
    return p; 
} 
bool isPalRec(string& str,  
              int s, int e) 
{ 
    // If there is only one character 
    if (s == e) 
    return true; 
  
    // If first and last 
    // characters do not match 
    if (str[s] != str[e]) 
    return false; 
  
    // If there are more than  
    // two characters, check if  
    // middle substring is also  
    // palindrome or not. 
    if (s < e + 1) 
    return isPalRec(str, s + 1, e - 1); 
  
    return true; 
} 
  
bool isPalindrome(string& str) 
{ 
int n = str.length(); 
 if(n==0)return true;
  
return isPalRec(str, 0, n - 1); 
} 
ll dp[3005][3005];
ll fun(VLL& arr,ll sum,ll e){
	if(sum<0)return 0;
	if(sum==0)return e+2;
	if(e<0)return 0;
	if(dp[e][sum]!=-1)return dp[e][sum];
	return dp[e][sum]=fun(arr,sum-arr[e],e-1)+fun(arr,sum,e-1);
}
int main(void)
{
	t_suman;

	ll n,s;
	cin>>n>>s;
	VLL arr(n);
	rep(i,0,n)cin>>arr[i];
	memset(dp,-1,sizeof(dp));
	fun(arr,s,n-1);
	ll res=0;
	for(int i=0;i<n;i++){
		res+=dp[i][s];
	}
	cout<<res;
	return 0;
}