#include <bits/stdc++.h>
using namespace std;
long long n;
vector<long long> arr;
vector<long long> pre;
long long dp[101][100001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long k;
  cin >> n >> k;
  arr.resize(n + 1);
  pre.resize(n + 1, 0);
  long long i, j;
  for (i = 1; i <= n; i++) {
    cin >> arr[i];
    pre[i] = pre[i - 1] + arr[i];
  }
  dp[1][0] = 1;
  for (i = 1; i <= n; i++) {
    for (j = 0; j <= k; j++) {
      if (j == pre[i]) {
        dp[i][j] = 1;
        break;
      }
      if (j == 0) {
        if (i == 1)
          continue;
        else
          dp[i][j] = dp[i - 1][j];
      } else {
        if (j > pre[i - 1]) {
          dp[i][j] = ((i - 1) * (arr[i] - (j - pre[i - 1])) + 1) %
                     (long long)(1e9 + 7);
        } else
          dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % (long long)(1e9 + 7);
      }
    }
  }
  cout << dp[n][k];
  return 0;
}
