#include <bits/stdc++.h>
long long int pow(long long int a, long long int b, long long int m) {
  a %= m;
  long long int x = 1, y = a;
  while (b > 0) {
    if (b % 2 == 1) {
      x = (x * y);
      if (x > m) x %= m;
    }
    y = (y * y);
    if (y > m) y %= m;
    b /= 2;
  }
  return x % m;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long int gen(long long int start, long long int end) {
  long long int diff = end - start;
  long long int temp = rand() % start;
  return temp + diff;
}
using namespace std;
long long int a[100001];
long long int dp[101][100001];
long long int psum[100001];
long long int getsum(int l, int r) {
  if (l == 0)
    return psum[r];
  else
    return ((psum[r] - psum[l - 1]) % 1000000007 + 1000000007) % 1000000007;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 0; i <= k; i++) psum[i] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      int r = min((long long int)j, a[i]);
      int l = max(0LL, j - a[i]);
      dp[i][j] += getsum(l, r);
      dp[i][j] %= 1000000007;
    }
    psum[0] = dp[i][0];
    for (int j = 1; j <= k; j++) {
      psum[j] = psum[j - 1] + dp[i][j];
      psum[j] %= 1000000007;
    }
  }
  cout << dp[n][k] << "\n";
}
