#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, c, d;
  cin >> a >> b;
  vector<long long int> v;
  for (long long int i = 0; i < a; i++) {
    cin >> c;
    v.push_back(c);
  }
  long long int dp[b + 1][a];
  for (long long int i = 0; i <= b; i++) {
    if (i <= v[a - 1])
      dp[i][a - 1] = 1;
    else
      dp[i][a - 1] = 0;
  }
  for (long long int i = 0; i < a; i++) {
    dp[0][i] = 1;
  }
  for (long long int i = a - 2; i >= 0; i--) {
    for (long long int j = 1; j <= b; j++) {
      long long int sum = 0;
      for (long long int k = 0; k <= v[i]; k++) {
        if ((j - k) >= 0) {
          sum += dp[j - k][i + 1];
          sum %= int(1e9) + 7;
        } else
          break;
      }
      dp[j][i] = sum;
    }
  }
  cout << dp[b][0];
}
