#include <bits/stdc++.h>
using namespace std;
int binary_search(vector<int> nums, int target_val) {
  int begin = 0;
  int end = nums.size();
  int mid;
  while (begin <= end) {
    mid = begin + (end - begin) / 2;
    if (nums[mid] == target_val)
      return mid;
    else if (nums[mid] <= target_val && nums[mid + 1] > target_val)
      return mid;
    else if (nums[mid] > target_val)
      end = mid - 1;
    else
      begin = mid + 1;
  }
  if (begin == 0)
    return -1;
  else
    return nums.size();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  vector<long long> nums(n);
  for (int i = 0; i < n; i++) cin >> nums[i];
  if (k == 0) {
    cout << 1 << endl;
    return 0;
  }
  vector<vector<long long>> ways(n + 1, vector<long long>(k));
  for (int i = 0; i < n + 1; i++) {
    ways[i][0] = 1;
  }
  for (int i = 0; i < n; i++) {
    for (long long j = 0; j <= k; j++) {
      long long num_ways = 0;
      for (long long a = 0; a <= min(nums[i], j); a++) {
        num_ways += ways[i][j - a];
      }
      ways[i + 1][j] = num_ways % 1000000007;
    }
  }
  cout << ways[n][k] % 1000000007 << "\n";
}
