import strformat, macros, algorithm, tables, sets, lists,
    intsets, critbits, sequtils, strutils, math, times, sugar, options, deques

const
  InfInt = 10^12
  NegInfInt = -10^12
  MOD = 10^9 + 7

template loop(n: int, body) = (for _ in 0..<n: body)
template `max=`(x, y) = x = max(x, y)
template `min=`(x, y) = x = min(x, y)

let readNext = iterator(getsChar: bool = false): string {.closure.} =
  for s in stdin.readAll.split:
    if getsChar:
      for i in 0..<s.len():
        yield s[i..i]
    else:
      yield s

proc read(t: typedesc[string]): string = readNext()
proc read(t: typedesc[char]): char = readNext(true)[0]
proc read(t: typedesc[int]): int = readNext().parseInt
proc read(t: typedesc[float]): float = readNext().parseFloat

macro read(t: typedesc, n: varargs[int]): untyped =
  var repStr = ""
  for arg in n:
    repStr &= &"({arg.repr}).newSeqWith "
  parseExpr(&"{repStr}read({t})")

var
  N: int
  K: int
  A: seq[int]
  dp: array[0..101, array[0..100_001, int]]

when isMainModule:
  N = read(int)
  K = read(int)
  A = read(int, N)

  for i in 0..N:
    dp[i][0] = 1

  for i in 1..N:
    for j in 1..K:
      dp[i][j] = dp[i][j-1] + dp[i-1][j]

      if j - A[i-1] - 1 >= 0:
        dp[i][j] -= dp[i-1][j-A[i-1]-1]

      dp[i][j] = dp[i][j] mod MOD

  echo dp[N][K]
