#include <bits/stdc++.h>
using namespace std;
int dp[105][100005], n, m, val[105];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &val[i]);
  for (int j = m; j > -1; j--) {
    if (j >= m - val[1])
      dp[1][j] = 1;
    else
      dp[1][j] = 0;
  }
  for (int i = 2; i <= n; i++) {
    int k = 0;
    for (int j = m; j > -1; j--) {
      if (j < m - val[i]) k -= dp[i - 1][j + val[i] + 1];
      k += dp[i - 1][j];
      k %= 1000000007;
      dp[i][j] = k;
    }
  }
  printf("%d", dp[n][0]);
}
