#include <bits/stdc++.h>
using namespace std;
int dp[110][100010];
int main() {
  int n, m;
  cin >> n >> m;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<int> sum(m + 1, 0);
  dp[1][0] = 1;
  sum[0] = 1;
  for (int i = 1; i <= a[0]; i++) dp[1][i] = 1;
  for (int i = 1; i <= m; i++) sum[i] = sum[i - 1] + dp[1][i];
  for (int i = 2; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      if (j >= a[i]) {
        dp[i][j] = (sum[j] - sum[j - a[i]] + 1000000007) % 1000000007;
      } else
        dp[i][j] = sum[j];
    }
    sum[0] = dp[i][0];
    for (int j = 1; j <= m; j++) sum[j] = (sum[j - 1] + dp[i][j]) % 1000000007;
  }
  cout << dp[n][m] << endl;
  return 0;
}
