using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var nk = Input.ar;
        var ar = Input.ar;
        var dp = new ModInt[nk[1] + 2];
        dp[nk[1]+1] = new ModInt(1);
        for(var i = 0; i < nk[0]; i++)
        {
            var newdp = new ModInt[nk[1] + 2];
            for (var j = 1; j <= nk[1]+1; j++)
                dp[j] += dp[j - 1];
            for (var j = 1; j <= nk[1]+1; j++)
                newdp[j] = dp[Min(nk[1]+1, j + ar[i])] - dp[j-1];
            dp = newdp;
        }
        WriteLine(dp[1]);
    }
}

public class Input
{
    public static string read => ReadLine().Trim();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(v => read.ToCharArray()).ToArray();
    public static int[][] ar2D(int num)
        => Enumerable.Repeat(0, num).Select(_ => ar).ToArray();
    public static long[][] arL2D(int num)
        => Enumerable.Repeat(0, num).Select(_ => arL).ToArray();
    public static T getValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(char))
            return (T)(object)char.Parse(g);
        if (t == typeof(double))
            return (T)(object)double.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        return default(T);
    }
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}

public struct ModInt
{
    public const long MOD = (int)1e9 + 7;
    public long num { get; set; }
    public ModInt(long n = 0) { num = n; }
    public override string ToString()
        => num.ToString();
    public static ModInt operator +(ModInt l,ModInt r)
    {
        l.num += r.num;
        if (l.num >= MOD) l.num -= MOD;
        return l;
    }
    public static ModInt operator -(ModInt l,ModInt r)
    {
        l.num -= r.num;
        if (l.num < 0) l.num += MOD;
        return l;
    }
    public static ModInt operator *(ModInt l, ModInt r)
        => new ModInt(l.num * r.num % MOD);
    public static implicit operator ModInt(long n)
    {
        n %= MOD;if (n < 0) n += MOD;
        return new ModInt(n);
    }
    public static ModInt Pow(ModInt v, long k)
        => Pow(v.num, k);

    public static ModInt Pow(long v,long k)
    {
        var tm = 1L;
        for (k %= MOD - 1; k > 0; k >>= 1, v = v * v % MOD)
            if ((k & 1) == 1) tm = tm * v % MOD;
        return new ModInt(tm);
    }
    public static ModInt Inverse(ModInt v)
        => Pow(v, MOD - 2);
}

Measured memory_bytes: 29000