#include <bits/stdc++.h>
using namespace std;
static const long long llMAX = numeric_limits<long long>::max();
static const int intMAX = numeric_limits<int>::max();
static const long long llMIN = numeric_limits<long long>::min();
static const int intMIN = numeric_limits<int>::min();
static const long long d_5 = 100000;
static const long long d9_7 = 1000000007;
static const long long d_9 = 1000000000;
static const double PI = 3.14159265358979323846;
template <class T>
void Printvector(std::vector<T> a) {
  int size = a.size();
  for (long long i = 0; i < size; i++) {
    cout << a[i] << " ";
  }
  cout << endl;
}
template <class T>
void Printvector(std::vector<std::vector<T>> a) {
  int size = a.size();
  for (long long i = 0; i < size; i++) {
    int size2 = a[i].size();
    for (long long j = 0; j < size2; j++) {
      cout << a[i][j] << " ";
    }
    cout << endl;
  }
  cout << endl;
}
long long digitpower(long long a, long long b) {
  if (b == 1) {
    return a;
  } else if (b == 0) {
    return 1;
  }
  if (b % 2 == 1) {
    long long tmp = digitpower(a, (b - 1) / 2);
    tmp %= d9_7;
    tmp *= tmp;
    tmp %= d9_7;
    tmp *= a;
    return (tmp) % d9_7;
  } else {
    long long tmp = digitpower(a, (b) / 2);
    tmp %= d9_7;
    tmp *= tmp;
    tmp %= d9_7;
    return (tmp) % d9_7;
  }
}
unordered_map<long long, long long> prime_factor(int64_t n) {
  unordered_map<long long, long long> ret;
  for (int64_t i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}
struct datas {
  long double x;
  long double r;
  long double h;
};
bool cmp(const datas &a, const datas &b) { return a.x < b.x; }
int main(void) {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<vector<long long>> dp(n + 1, vector<long long>(k + 1, 0));
  for (long long i = 0; i < n; i++) {
    if (i == 0) {
      for (long long k = 0; k < a[i] + 1; k++) {
        dp[i + 1][k] = 1;
      }
      continue;
    }
    for (int j = 0; j <= k; j++) {
      for (long long k = 0; k < a[i] + 1; k++) {
        if (j - k < 0) break;
        dp[i + 1][j] += dp[i][j - k];
        dp[i + 1][j] %= d9_7;
      }
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
