#include <bits/stdc++.h>
using namespace std;
const long long int logx = 30;
const long long int N = 1e5 + 5;
const long long int INF = 1e18 + 5;
const long long int mod = 1e9 + 7;
const double PI = 3.14159265358979323846;
inline long long int mul(long long int a, long long int b, long long int p) {
  return (a * 1ll * b) % p;
}
inline long long int sub(long long int a, long long int b, long long int p) {
  long long int c = a - b;
  if (c < 0) c += p;
  return c;
}
inline long long int add(long long int a, long long int b, long long int p) {
  long long int c = a + b;
  if (c > p) c -= p;
  return c;
}
template <typename T>
T power(T x, T y, long long int m) {
  T ans = 1;
  while (y > 0) {
    if (y & 1LL) ans = (ans * x) % m;
    y >>= 1ll;
    x = (x * x) % m;
  }
  return ans % m;
}
long long int n, k, a[N], dp[105][N], pre[105][N];
int main() {
  cin >> n >> k;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long int i = 0; i <= a[0]; i++) {
    dp[0][i] = 1;
    pre[0][i] = (i + 1);
  }
  for (long long int i = a[0] + 1; i <= k; i++) {
    pre[0][i] = pre[0][i - 1];
  }
  for (long long int i = 1; i < n; i++) {
    for (long long int j = 0; j <= k; j++) {
      long long int pos = min(j, a[i]);
      long long int l = j - pos - 1, r = j;
      if (l < 0) {
        dp[i][j] = add(dp[i][j], pre[i - 1][r], mod);
      } else {
        dp[i][j] = add(dp[i][j], pre[i - 1][r] - pre[i - 1][l], mod);
      }
    }
    for (long long int j = 0; j <= k; j++) {
      pre[i][j] = dp[i][j];
    }
    for (long long int j = 1; j <= k; j++) {
      pre[i][j] = add(pre[i][j], pre[i][j - 1], mod);
    }
  }
  cout << dp[n - 1][k] << endl;
}
