#include <bits/stdc++.h>
using namespace std;
long long dp[100005], num[105];
int main() {
  long long n, k, temp;
  cin >> n >> k;
  for (long long i = 0; i < n; ++i) {
    cin >> num[i];
  }
  dp[0] = 1;
  for (long long i = 0; i < n; ++i) {
    for (long long j = k; j >= 0; --j) {
      temp = 0;
      if (j == 0) {
        temp = 1;
      } else {
        for (int h = 0; h <= j && h <= num[i]; ++h) {
          temp += dp[j - h];
        }
      }
      dp[j] = temp;
    }
  }
  cout << dp[k] % (1000000007) << endl;
  return 0;
}
