#include <bits/stdc++.h>
using namespace std;
int dp[100][100000];
int ways(int i, int j, vector<int> &v) {
  if (i < 0) {
    return 0;
  }
  if (i == 0 && j != 0) {
    return dp[i][j] = 0;
  } else if (j == 0) {
    return dp[i][j] = 1;
  } else {
    if (dp[i][j] != -1) {
      return dp[i][j];
    }
    int ans = 0;
    for (int k = 0; k <= v.at(i); k++) {
      ans = (ans % 1000000007 +
             (j - k >= 0 ? ways(i - 1, j - k, v) : 0) % 1000000007) %
            1000000007;
    }
    return dp[i][j] = ans;
  }
}
int solve(int n, int k, vector<int> &v) {
  memset(dp, -1, sizeof(dp));
  return ways(n, k, v);
}
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> v.at(i);
  }
  cout << solve(n, k, v);
  return 0;
}
