#include <bits/stdc++.h>
#pragma GCC optimize "trapv"
using namespace std;
int MOD = 1e9 + 7;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  {
    int n, k;
    cin >> n >> k;
    int a[n + 1];
    for (int i = 1; i <= n; i++) cin >> a[i];
    long long dp[n + 1][k + 1];
    for (int i = 0; i <= n; i++)
      for (int j = 0; j <= k; j++) dp[i][j] = 0;
    for (int i = 0; i <= a[1]; i++) dp[1][i] = 1;
    for (int i = 2; i <= n; i++)
      for (int j = 0; j <= k; j++) {
        int k = 0;
        while (j - k >= 0 && k <= a[i]) {
          dp[i][j] = (dp[i][j] + dp[i - 1][j - k]) % MOD;
          k++;
        }
      }
    cout << dp[n][k];
  }
}
