#include <bits/stdc++.h>
#pragma GCC optimize("-O3")
using namespace std;
const double PI = acos(-1);
long long gcd() { return 0ll; }
template <typename T, typename... Args>
T gcd(T a, Args... args) {
  return __gcd(a, (__typeof(a))gcd(args...));
}
long long dp[101][100002], pre[100002];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  long long a[n];
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n)))
    cin >> a[i];
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n)))
    for (__typeof(100002) j = (0) - ((0) > (100002));
         j != (100002) - ((0) > (100002)); j += 1 - 2 * ((0) > (100002)))
      dp[i][j] = 0;
  for (__typeof(a[0] + 1) i = (0) - ((0) > (a[0] + 1));
       i != (a[0] + 1) - ((0) > (a[0] + 1)); i += 1 - 2 * ((0) > (a[0] + 1)))
    dp[0][i] = 1;
  for (__typeof(n) i = (1) - ((1) > (n)); i != (n) - ((1) > (n));
       i += 1 - 2 * ((1) > (n))) {
    for (__typeof(k + 1) j = (0) - ((0) > (k + 1));
         j != (k + 1) - ((0) > (k + 1)); j += 1 - 2 * ((0) > (k + 1))) {
      pre[j] = dp[i - 1][j] + ((j - 1 >= 0) ? pre[j - 1] : 0);
      pre[j] %= 1000000007;
      dp[i][j] =
          (pre[j] - ((j - a[i] - 1 >= 0) ? pre[j - a[i] - 1] : 0)) % 1000000007;
      dp[i][j] = (dp[i][j] + 1000000007) % 1000000007;
    }
  }
  cout << dp[n - 1][k] << "\n";
  return 0;
}
