#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  std::cin >> n >> k;
  vector<int> child(n);
  for (int i = 0; i < n; i++) {
    cin >> child[i];
  }
  int mod = 1000000007;
  vector<vector<int> > dp(n + 1, vector<int>(k + 1, 0));
  for (int i = 0; i <= n; i++) {
    dp[i][0] = 1;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      for (int o = 0; o <= child[i - 1]; o++) {
        dp[i][j] = (dp[i][j] % mod + dp[i - 1][j - o] % mod) % mod;
      }
    }
  }
  std::cout << dp[n][k] << std::endl;
  return 0;
}
