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