using System;
using System.Collections.Generic;
using System.Linq;

class M
{
	static void Main()
	{
		Func<int[]> read = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
		var h = read();
		var a = read();
		int n = h[0], k = h[1];

		var dp = new int[n + 1, k + 1];
		for (int i = 0; i <= n; i++) dp[i, 0] = 1;
		for (int i = 1; i <= n; i++)
			for (int j = 1; j <= k; j++)
				dp[i, j] = Range(Math.Max(0, j - a[i - 1]), j).Sum(x => dp[i - 1, x]);
		Console.WriteLine(dp[n, k]);
	}

	static IEnumerable<int> Range(int m, int M) { for (var i = m; i <= M; i++) yield return i; }
}
