#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
void go() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed;
  cout << setprecision(20);
}
int main() {
  go();
  int n, k;
  cin >> n >> k;
  int arr[n];
  for (int i = 0; i < n; i += 1) cin >> arr[i];
  vector<vector<int>> dp(n + 1, vector<int>(k + 1, 0));
  for (int i = 0; i <= n; i++) dp[i][k] = 1;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = k - 1; j >= 0; j--) {
      for (int can = 0; can <= arr[i]; can++) {
        if ((can + j) > k) break;
        dp[i][j] += dp[i + 1][j + can];
        dp[i][j] %= MOD;
      }
    }
  }
  cout << dp[0][0];
}
