#include <bits/stdc++.h>
using namespace std;
int n, k, a[105];
int dp[105][100005], p[105][100005];
const int mod = 1e9 + 7;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i <= n; i++) {
    dp[i][0] = 1;
    p[i][0] = 1;
  }
  for (int i = 0; i <= k; i++) {
    p[0][i] = 1;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= k; j++) {
      int st = min(a[i], j);
      if (j - st - 1 < 0) {
        dp[i][j] = p[i - 1][j];
      } else {
        dp[i][j] = (p[i - 1][j] - p[i - 1][j - st - 1]) % mod;
      }
      p[i][j] = (p[i][j - 1] + dp[i][j]) % mod;
    }
  printf("%d\n", dp[n][k]);
}
