#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int main() {
  int n, k;
  cin >> n >> k;
  int arr[n + 1];
  (i, a, b) for (int i = a; i <= b; i++)(i, 0, n) cin >> arr[i];
  int dp[n + 1][k + 1];
  (i, a, b) for (int i = a; i <= b; i++)(i, 0, k) dp[1][i] = i > arr[0] ? 0 : 1;
  (i, a, b) for (int i = a; i <= b; i++)(i, 2, n) {
    (i, a, b) for (int i = a; i <= b; i++)(j, 0, k) {
      if (j == 0)
        dp[i][j] = dp[i - 1][j];
      else
        dp[i][j] =
            (mod + dp[i][j - 1] + dp[i - 1][j] -
             (j - 1 - arr[i - 1] >= 0 ? dp[i - 1][j - 1 - arr[i - 1]] : 0)) %
            mod;
    }
  }
  cout << dp[n][k] % mod;
  return 0;
}
