#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int n, m;
int a[121];
int dp[100021];
int s[100021];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 0; i <= a[1]; ++i) dp[i] = 1;
  s[0] = 1;
  for (int i = 2; i <= n; ++i) {
    for (int j = 1; j <= m; ++j)
      s[j] = (long long(s[j - 1]) + long long(dp[j])) % MOD;
    for (int j = m; j >= 0; --j)
      dp[j] += (long long(s[j - 1]) - long long(s[j - min(a[i], j)]) +
                long long(dp[j - min(a[i], j)]));
  }
  printf("%d\n", dp[m] % MOD);
  return 0;
}
