#include <bits/stdc++.h>
using namespace std;
const long long int N = 101;
const long long int M = 100001;
long long int dp[N][M];
long long int n;
long long int k;
long long int arr[N];
long long int INF = 10000000000000000;
long long int go(long long int index, long long int count) {
  if (index == n && count == k)
    return 1;
  else if (index == n)
    return 0;
  if (dp[index][count] != -1) return dp[index][count];
  long long int ans = 0;
  for (long long int i = 0; i <= arr[index]; i++) {
    ans += go(index + 1, count + i);
    ans %= 1000000007;
  }
  return dp[index][count] = ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  while (t--) {
    cin >> n >> k;
    for (long long int i = 0; i < n; i++) {
      cin >> arr[i];
    }
    memset(dp, -1, sizeof(dp));
    cout << go(0, 0);
  }
  return 0;
}
