#include <bits/stdc++.h>
using namespace std;
template <typename T>
T nCr(T n, T r) {
  if (r > n - r) r = n - r;
  int ans = 1, i;
  for (i = 1; i <= r; i++) {
    ans *= n - r + i;
    ans /= i;
  }
  return ans;
}
long long fact(long long n) {
  long long ans = 1;
  for (long long i = 1; i <= n; i++) {
    ans *= i;
  }
  return ans;
}
long long power(long long x, long long y) {
  if (y == 0) return 1;
  long long res = power(x, y / 2);
  long long resf = res * res;
  if (y % 2) return resf * x;
  return resf;
}
long long modularExponentiation(long long x, long long n, long long M) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return modularExponentiation((x * x) % M, n / 2, M);
  return (x * modularExponentiation((x * x) % M, (n - 1) / 2, M)) % M;
}
long long binaryExponentiation(long long x, long long n) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return binaryExponentiation(x * x, n / 2);
  else
    return x * binaryExponentiation(x * x, (n - 1) / 2);
}
long long GCD(long long A, long long B) {
  if (B == 0)
    return A;
  else
    return GCD(B, A % B);
}
long long extended_GCD(long long a, long long b, long long &x, long long &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long x1, y1;
  long long gcd = extended_GCD(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return gcd;
}
long long modInv(long long a, long long mod) {
  long long x, y;
  extended_GCD(a, mod, x, y);
  if (x < 0) x += mod;
  return x;
}
long long modPrimeInv(long long A, long long M) {
  return modularExponentiation(A, M - 2, M);
}
void sieve(long long N) {
  vector<bool> isPrime(N + 1, true);
  for (long long i = 0; i <= N; ++i) {
    isPrime[i] = true;
  }
  isPrime[0] = false;
  isPrime[1] = false;
  for (long long i = 2; i * i <= N; ++i) {
    if (isPrime[i] == true) {
      for (long long j = i * i; j <= N; j += i) isPrime[j] = false;
    }
  }
}
long long minPrime[1000007];
void factorSieve(long long n) {
  memset(minPrime, 0, sizeof(minPrime));
  for (long long i = 2; i * i <= n; ++i) {
    if (minPrime[i] == 0) {
      for (long long j = i * i; j <= n; j += i) {
        if (minPrime[j] == 0) {
          minPrime[j] = i;
        }
      }
    }
  }
  for (long long i = 2; i <= n; ++i) {
    if (minPrime[i] == 0) {
      minPrime[i] = i;
    }
  }
}
long long factorize(long long n) {
  map<long long, long long> m;
  m.clear();
  while (n != 1) {
    m[minPrime[n]]++;
    n /= minPrime[n];
  }
  for (auto i : m) {
    cout << i.first << " " << i.second << "\n";
  }
  return 1;
}
void merge(long long A[], long long start, long long mid, long long end) {
  long long p = start, q = mid + 1;
  long long Arr[end - start + 1], k = 0;
  for (long long i = start; i <= end; i++) {
    if (p > mid)
      Arr[k++] = A[q++];
    else if (q > end)
      Arr[k++] = A[p++];
    else if (A[p] < A[q])
      Arr[k++] = A[p++];
    else
      Arr[k++] = A[q++];
  }
  for (long long p = 0; p < k; p++) {
    A[start++] = Arr[p];
  }
}
void merge_sort(long long A[], long long start, long long end) {
  if (start < end) {
    long long mid = (start + end) / 2;
    merge_sort(A, start, mid);
    merge_sort(A, mid + 1, end);
    merge(A, start, mid, end);
  }
}
long long binarySearch(long long a[], long long low, long long high,
                       long long key) {
  while (low <= high) {
    long long mid = (low + high) / 2;
    if (a[mid] < key) {
      low = mid + 1;
    } else if (a[mid] > key) {
      high = mid - 1;
    } else {
      return mid;
    }
  }
  return -1;
}
bool sortbysec(const pair<long long, long long> &a,
               const pair<long long, long long> &b) {
  if (a.first == b.first) {
    a.second > b.second;
  }
  return (a.first < b.first);
}
vector<long long> arr(105, 0);
vector<vector<long long>> dp(105, vector<long long>(100005, -1));
long long fun(long long p, long long k, long long n) {
  if (p >= n) {
    if (k == 0)
      return 1;
    else
      return 0;
  }
  if (dp[p][k] != -1) return dp[p][k];
  long long ans = 0;
  for (long long i = 0; i <= arr[p]; i++) {
    ans = (ans % 1000000007 + fun(p + 1, k - i, n) % 1000000007) % 1000000007;
  }
  dp[p][k] = ans;
  return ans;
}
void solve() {
  long long n, k;
  cin >> n >> k;
  for (long long i = 0; i < n; i++) cin >> arr[i];
  cout << fun(0, k, n);
}
int main() {
  ;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
