#include <bits/stdc++.h>
using namespace std;
vector<long long> factors;
int IT_MAX = 1 << 17;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<long long> a(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  vector<vector<long long>> dp(n + 1, vector<long long>(k + 1));
  for (int i = 0; i <= n; ++i) {
    dp[i][0] = 1;
  }
  for (int i = 1; i <= k; ++i) {
    dp[0][i] = 0;
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= k; ++j) {
      dp[i][j] = ((dp[i - 1][j] + dp[i][j - 1]) % MOD -
                  ((j > a[i]) ? dp[i - 1][j - a[i] - 1] : 0) % MOD) %
                 MOD;
      if ((dp[i - 1][j] + dp[i][j - 1]) % MOD -
              ((j > a[i]) ? dp[i - 1][j - a[i] - 1] : 0) % MOD <
          0) {
        while (true) {
          long long a = 10;
          a *= 10;
        }
      }
    }
  }
  cout << dp[n][k];
  return 0;
}
