#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
void add_self(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
int main(void) {
  int n;
  cin >> n;
  int k;
  cin >> k;
  vector<int> dp(k + 1);
  dp[0] = 1;
  for (int child = 0; child < n; ++child) {
    int upto;
    cin >> upto;
    for (int used = k; used >= 0; --used) {
      for (int here = 1; here <= min(upto, k - used); here++) {
        add_self(dp[used + here], dp[used]);
      }
    }
  }
  cout << dp[k];
}
