#include <bits/stdc++.h>
using namespace std;
int n, k;
long long a[105], dp[105][100005], qzh[105];
long long sum[105][100005];
int main() {
  cin >> n >> k;
  for (register int i = 1; i <= n; ++i) cin >> a[i];
  for (register int i = 0; i <= k; ++i) sum[0][i] = 1;
  for (register long long i = 1; i <= n; ++i)
    for (register long long j = 0; j <= k; ++j) {
      if (j - min(a[i], j) - 1 < 0)
        (dp[i][j] += sum[i - 1][j]) % 1000000007;
      else
        (dp[i][j] += sum[i - 1][j] - sum[i - 1][j - min(a[i], j) - 1]) %
            1000000007;
      if (j - 1 < 0)
        sum[i][j] = dp[i][j];
      else
        (sum[i][j] = sum[i][j - 1] + dp[i][j]) % 1000000007;
    }
  cout << dp[n][k] << endl;
  return 0;
}
