#include <bits/stdc++.h>
using namespace std;
#define ll long long                  // Short form for long long
#define ld long double                // Short form for long double
typedef pair<ll, ll> pii;              // Pair of long long
typedef vector<ll> vi;                // Vector of long long
typedef vector<vi> vvi;               // Vector of vector of long long
typedef vector<pii> vii;               // Vector of pairs
typedef vector<vii> vvii;             // Vector of vector of pairs
#define pq priority_queue             // Max heap (To convert to min heap, use negative sign before every value)
#define ff first                      // For pairs
#define ss second                     // For pairs
#define pb push_back                  // Pushback to vector
#define mp make_pair                  // Makes pairs to be stored as pair
#define all(c) (c).begin(), (c).end() // Mainly used by me in sorting

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
vvi adj;
ll n,m,x,y,k;
// vi dp,vis;
ll mod = 1e9 + 7;
ll t=1;
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; 
} 

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // cin>>t;
    while(t--){
        cin>>n>>k;
        vi a(n+1),s(n+1);
        s[0]=0;
        for(int i=1;i<=n;i++){cin>>a[i];s[i]=s[i-1]+a[i];}
        sort(all(a));
        ll dp[k+1][n+1]={0};
        for(int i=0;i<=n;i++)dp[0][i]=1;
        for(int i=1;i<=k;i++)dp[i][0]=0;
        for(int i=1;i<=k;i++){
            for(int j=1;j<=n;j++){
                
                // if(i>s[j])continue;
                
                ll x = min((ll)i,a[j]);
                
                // else if(i==s[j]){dp[i][j]=1;continue;}
                // if(i==2 && j==1){cout<<x<<"\n";}
                
                if(x==i)dp[i][j] = dp[i-1][j] + dp[i][j-1];
                else{ 
                    
                    dp[i][j] = dp[i-1][j] + dp[i][j-1] - dp[i-x-1][j-1];
                }
                
                // dp[i][j] = dp[i][j-1] + dp[i-1][j] - dp[i-x][j-1];
                
                dp[i][j]%=mod;
                // while(x>=0){dp[i][j]+=dp[i-x][j-1];x--;dp[i][j]%=mod;}
                
            }
        }
        
        // for(int i=0;i<=k;i++){
        //     for(int j=0;j<=n;j++){
        //         cout<<dp[i][j]<<" ";
        //     }cout<<"\n";
        // }
        dp[k][n]%=mod;
        cout<<dp[k][n];


        
    }
    return 0;
}    