#include <bits/stdc++.h>
using namespace std;
long long int n, k, sum = 0;
vector<long long int> bound(100001);
vector<vector<long long int>> dp(100001, vector<long long int>(100001));
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> n >> k;
  for (long long int i = 1; i <= n; i++) {
    cin >> bound[i];
  }
  for (long long int j = 1; j <= n; j++) {
    dp[0][j] = 1;
  }
  for (long long int i = 1; i <= k; i++) {
    if (i <= bound[1])
      dp[i][1] = 1;
    else
      break;
  }
  for (long long int j = 2; j <= n; j++) {
    for (long long int i = 1; i <= k; i++) {
      sum = 0;
      for (long long int r = 0; r <= bound[j]; r++) {
        if ((i - r) >= 0)
          sum += (dp[i - r][j - 1]) % 1000000007;
        else
          break;
      }
      dp[i][j] = (sum) % 1000000007;
    }
  }
  cout << dp[k][n];
  return 0;
}
