#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, c;
  long long int x;
  cin >> n >> c;
  vector<long long int> a;
  for (int i = 0; i < n; i++) {
    cin >> x;
    a.push_back(x);
  }
  vector<vector<long long int>> dp(n + 1, vector<long long int>(c + 1, 0));
  for (int i = 0; i <= n; i++) dp[i][0] = 1;
  for (long long int i = 1; i <= n; i++) {
    for (long long int j = 1; j <= c; j++) {
      for (long long int k = 0; k <= min(j, a[i - 1]); k++) {
        dp[i][j] = (dp[i][j] % 1000000007 + dp[i - 1][j - k] % 1000000007) %
                   1000000007;
      }
    }
  }
  cout << dp[n][c] << endl;
  return 0;
}
