#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int main() {
  int n, k;
  cin >> n >> k;
  long long arr[n + 1];
  (i, a, b) for (int i = a; i <= b; i++)(i, 0, n) cin >> arr[i];
  long long dp[n + 1][k + 1];
  (i, a, b) for (int i = a; i <= b; i++)(i, 0, n) dp[i][0] = 1;
  (i, a, b) for (int i = a; i <= b; i++)(i, 1, k) dp[0][i] = 1;
  (i, a, b) for (int i = a; i <= b; i++)(i, 1, n) {
    (i, a, b) for (int i = a; i <= b; i++)(j, 1, k) {
      dp[i][j] =
          (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;
}
