#include <bits/stdc++.h>
using namespace std;
enum enum_t { White, Black, Gray };
inline int readInt() {
  char c;
  while (c = getchar(), c != '-' && (c < '0' || c > '9'))
    ;
  bool sign = (c == '-');
  if (sign) c = getchar();
  int n = c - '0';
  while (c = getchar(), c >= '0' && c <= '9') n = 10 * n + c - '0';
  return (!sign) ? n : -n;
}
inline long long readLong() {
  char c;
  while (c = getchar(), c != '-' && (c < '0' || c > '9'))
    ;
  bool sign = (c == '-');
  if (sign) c = getchar();
  long long n = c - '0';
  while (c = getchar(), c >= '0' && c <= '9') n = 10 * n + c - '0';
  return (!sign) ? n : -n;
}
inline void getInt(int &n) {
  char c;
  while (c = getchar(), c != '-' && (c < '0' || c > '9'))
    ;
  bool sign = (c == '-');
  if (sign) c = getchar();
  n = c - '0';
  while (c = getchar(), c >= '0' && c <= '9') n = 10 * n + c - '0';
  if (sign) n = -n;
}
inline void getLong(long long &n) {
  char c;
  while (c = getchar(), c != '-' && (c < '0' || c > '9'))
    ;
  bool sign = (c == '-');
  if (sign) c = getchar();
  n = c - '0';
  while (c = getchar(), c >= '0' && c <= '9') n = 10 * n + c - '0';
  if (sign) n = -n;
}
inline string readString() {
  char c;
  while (c = getchar(), c == ' ' || c == '\n' || c == '\t')
    ;
  string s({c});
  while (c = getchar(), c != EOF && c != ' ' && c != '\n' && c != '\t') s += c;
  return s;
}
char bufWrite[20];
template <typename T>
inline void writeInt(T x) {
  if (x < 0) putchar('-'), x = -x;
  char *bufPos = bufWrite;
  do {
    *bufPos++ = x % 10 + '0';
  } while (x /= 10);
  do {
    putchar(*--bufPos);
  } while (bufPos > bufWrite);
}
template <typename T>
inline void printInt(T x, char c = EOF) {
  if (x < 0) putchar('-'), x = -x;
  char *bufPos = bufWrite;
  do {
    *bufPos++ = x % 10 + '0';
  } while (x /= 10);
  do {
    putchar(*--bufPos);
  } while (bufPos > bufWrite);
  if (c != EOF) putchar(c);
}
template <typename T>
inline T gcd(T a, T b) {
  while (b != 0) swap(b, a %= b);
  return a;
}
template <typename T>
inline T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <typename T>
inline tuple<T, T, T> extgcd(T a, T b) {
  if (!a) return make_tuple(b, 0, 1);
  T g, x, y;
  tie(g, x, y) = extgcd(b % a, a);
  return make_tuple(g, y - (b / a) * x, x);
}
template <class T>
T bitGet(T x, int bit) {
  return T(1) & (x >> (bit - 1));
}
template <class T>
void bitSet(T &x, int bit) {
  x |= (T(1) << (bit - 1));
}
template <class T>
void bitReset(T &x, int bit) {
  x &= ~(T(1) << (bit - 1));
}
template <class T>
void bitFlip(T &x, int bit) {
  x ^= (T(1) << (bit - 1));
}
template <class T>
void bitMake(T &x, int bit, bool val) {
  x ^= (T(1) << (bit - 1)) & (-val ^ x);
}
const long long LINF = (1LL << 60);
const int INF = (1 << 30);
const int LIM = (1 << 24);
const int MOD = 1e9 + 7;
const int BASE = 1e4;
const int DIGIT = 4;
vector<int> a;
int n, k;
vector<vector<int> > f;
int magic(int i = 0, int s = k) {
  if (i >= n) return s == 0;
  int &res = f[i][s];
  if (res != -1)
    return res;
  else
    res = 0;
  int lim = min(s, a[i]);
  for (int j = 0; j <= lim; ++j) res = (res + magic(i + 1, s - j)) % MOD;
  return res;
}
int formagic() {
  f.assign(n + 1, vector<int>(k + 1, 0));
  for (int i = 0; i <= n; ++i) f[i][0] = 1;
  for (int i = 1; i <= n; ++i)
    for (int t = 0; t <= k; ++t)
      for (int j = 0; j <= min(t, a[i]); ++j)
        f[i][t] = (f[i][t] + f[i - 1][t - j]) % MOD;
  return f[n][k];
}
int main() {
  n = readInt();
  k = readInt();
  a.resize(n);
  for (int &x : a) x = readInt();
  cout << magic();
  return 0;
}
