#include <bits/stdc++.h>
using namespace std;
int v[110];
int dp[110][100010];
const int mod = 1e9 + 7;
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; ++i) cin >> v[i];
  dp[n + 1][0] = 1;
  for (int i = n; i >= 1; --i)
    for (int j = 0; j <= k; ++j)
      for (int l = 0; l <= min(j, v[i]); ++l)
        if (j - l >= 0) {
          dp[i][j] += dp[i + 1][j - l];
          dp[i][j] %= mod;
        }
  printf("%d\n", dp[1][k]);
  return 0;
}
