#include <bits/stdc++.h>
using namespace std;
const int N = 102;
const int MX = 100005;
int ar[N];
long long dp[N][MX];
int n, k;
long long F(int pos, int taken) {
  if (pos >= n) {
    if (taken == k) {
      return 1;
    }
    return 0;
  }
  if (dp[pos][taken] != -1) return dp[pos][taken];
  long long sum = 0;
  for (int i = 0; i <= ar[pos]; i++) {
    if (taken + i <= k)
      sum =
          (sum % 1000000007 + F(pos + 1, taken + i) % 1000000007) % 1000000007;
    else
      break;
  }
  return dp[pos][taken] = sum;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  memset(dp, -1, sizeof(dp));
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
  }
  cout << F(0, 0) % 1000000007 << "\n";
  ;
  return 0;
}
