#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1, n, k;
  while (t--) {
    cin >> n >> k;
    vector<vector<unsigned long long int>> dp(
        n + 1, vector<unsigned long long int>(k + 1, 0));
    int a[100000];
    a[0] = -1;
    for (int i = 1; i < n + 1; i++) {
      cin >> a[i];
    }
    for (int i = 0; i < a[1] + 1; i++) {
      dp[1][i] = 1;
    }
    for (int i = 2; i < n + 1; i++)
      for (int l = 0; l < a[i] + 1; l++)
        for (int j = l; j < k + 1; j++) {
          dp[i][j] += dp[i - 1][j - l];
          dp[i][j] = dp[i][j] % 1000000007;
        }
    cout << dp[n][k] % 1000000007 << endl;
  }
  return 0;
}
