#include <bits/stdc++.h>
using namespace std;
int dp[100001][101];
int findWays(int candies, int childs, vector<int> &maxCandies) {
  if (candies == 0) {
    return 1;
  } else if (childs == 0) {
    return 0;
  }
  if (dp[candies][childs] != -1) {
    return dp[candies][childs];
  }
  int totalWays = 0;
  for (int i = 0; i <= maxCandies[childs - 1]; i++) {
    if (candies - i >= 0)
      totalWays =
          ((totalWays % 1000000007) +
           (findWays(candies - i, childs - 1, maxCandies) % 1000000007)) %
          1000000007;
  }
  dp[candies][childs] = totalWays;
  return dp[candies][childs];
}
int findTotalWays(int candies, int childs, vector<int> &maxCandies) {
  memset(dp, -1, sizeof(dp));
  return findWays(candies, childs, maxCandies);
}
int main() {
  int childs;
  cin >> childs;
  int candies;
  cin >> candies;
  vector<int> maxCandies;
  int maxCandy;
  for (int i = 0; i < childs; i++) {
    cin >> maxCandy;
    maxCandies.push_back(maxCandy);
  }
  cout << findTotalWays(candies, childs, maxCandies) << endl;
  return 0;
}
