#include <bits/stdc++.h>
using namespace std;
long int dp[101][100005];
int main() {
  int n, k;
  cin >> n >> k;
  vector<long long int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    dp[i][0] = 1;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      dp[i][j] = 0;
      for (int r = 0; r <= v[i - 1]; r++) {
        if (j - r >= 0)
          dp[i][j] = (dp[i][j] % 1000000007 + dp[i - 1][j - r] % 1000000007) %
                     1000000007;
      }
    }
  }
  cout << dp[n][k];
  return 0;
}
