#include <bits/stdc++.h>
using namespace std;
inline long long int power(long long int a, long long int b) {
  long long int x = 1;
  while (b) {
    if (b & 1) x *= a;
    a *= a;
    b >>= 1;
  }
  return x;
}
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const long long int N = 3e5 + 7;
vector<vector<long long int> > adj;
bool vis[N];
long long int arr[105];
long long int dp[105][100005];
void solve() {
  long long int n, k;
  cin >> n >> k;
  for (long long int i = 1; i < n + 1; i++) cin >> arr[i];
  dp[0][0] = 1;
  for (long long int i = 1; i < n + 1; i++) {
    for (long long int j = 0; j < k + 1; j++) {
      long long int ans = 0;
      if (i - 1 >= 0) ans += dp[(i - 1)][j];
      if (j - 1 >= 0) ans += dp[i][j - 1], ans %= 1000000007;
      if (j - arr[i] >= 0) {
        ans -= dp[(i - 1)][j - 1 - arr[i]];
        ans %= 1000000007;
      }
      if (ans < 0) ans += 1000000007;
      dp[i][j] = ans;
    }
  }
  cout << dp[n][k] << "\n";
  return;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << setprecision(9) << fixed;
  long long int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
