#include <bits/stdc++.h>
using namespace std;
long long students, candies;
vector<vector<long long>> dp;
long long func(long long *a, long long person, long long candy) {
  if (person >= students) {
    if (candy == candies) {
      return 1;
    }
    return 0;
  }
  if (candy > candies) {
    return 0;
  }
  if (dp[person][candy] != -1) {
    return dp[person][candy];
  }
  long long ans = 0;
  for (long long n = 0; n <= a[person]; n++) {
    ans += func(a, person + 1, candy + n);
    ans %= 1000000007;
  }
  return dp[person][candy] = ans % 1000000007;
}
int main() {
  cin >> students >> candies;
  long long a[students];
  for (long long i = 0; i < students; i++) {
    cin >> a[i];
  }
  dp.resize(students + 1, vector<long long>(candies + 1, -1));
  cout << func(a, 0, 0);
  return 0;
}
