from collections import defaultdict
def get_answer(candies,personal):
  dp = [[-1 for _ in range(candies+1)] for _ in range(len(personal) + 1)]
  def candy(rem,i,n):
    if rem<0:
      return 0
    if dp[i][rem]!= -1:  #toggle flag
      #print(rem,i)
      return dp[i][rem];
    if rem==0:
      return 1
    if i>=n:
      return 0
    ans = 0;
    for curr in range(0,personal[i] + 1):  #if i==n-1, then use up all rem?prolly
      ans+= candy(rem-curr,i+1,n)
    dp[i][rem] = ans;
    return ans
  return candy(candies,0,len(personal))

n,candies = tuple(map(int,input().split()))
personal = list(map(int,input().split()))
print(get_answer(candies,personal))