#include <bits/stdc++.h>
using namespace std;
void DebugPrint(vector<long long int> &a, int n) {}
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<long long int> dp(k + 1, 0);
  dp[0] = 1;
  for (int loop = 0; loop < n; ++loop) {
    for (int i = k; i >= 0; --i) {
      long long int sum = 0;
      int end = min(a[loop], i);
      for (int j = 0; j <= end; ++j) {
        sum += dp[i - j];
      }
      sum %= 1000000007;
      dp[i] = sum;
    }
    DebugPrint(dp, k + 1);
  }
  cout << dp[k] << endl;
  return 0;
}
