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;
        Func<ModInt, ModInt, ModInt> func =
            (ModInt a, ModInt b) => a + b;
        var seg = Enumerable.Repeat(0, nk[0] + 1).Select(_ => new SegmentTree<ModInt>(nk[1] + 1, new ModInt(), func, func)).ToArray();
        seg[0].Update(nk[1], new ModInt(1));
        for (var i = 1; i <= nk[0]; i++)
            for (var j = 0; j <= nk[1]; j++)
                seg[i].Update(j, seg[i - 1].Query(j, Min(nk[1], j + ar[i - 1]) + 1));
        WriteLine(seg[nk[0]].Query(0, 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 class SegmentTree<T>
{
    private readonly List<T> item;
    private readonly int _num;
    private readonly Func<T, T, T> _func;
    private readonly Func<T, T, T> updateFunc;
    private readonly T _init;

    private int Parent(int index)
        => (index - 1) / 2;
    private int Left(int index)
        => 2 * index + 1;
    private int Right(int index)
        => 2 * (index + 1);

    public SegmentTree(int num, T init, Func<T, T, T> func, Func<T, T, T> updateFunc = null)
    {
        _func = func;
        _num = 1;
        _init = init;
        this.updateFunc = updateFunc ?? ((T val1, T val2) => val2);
        while (_num <= num)
            _num *= 2;
        item = new List<T>(2 * _num - 1);
        for (var i = 0; i < 2 * _num - 1; i++)
            item.Add(init);
    }
    public void Update(int index, T value)
    {
        index += _num - 1;
        item[index] = updateFunc(item[index], value);
        while (index > 0)
        {
            index = Parent(index);
            item[index] = _func(item[Left(index)], item[Right(index)]);
        }
    }
    public void Update(int left, int right, T value)
        => Update(left, right, 0, 0, _num, value);
    private void Update(int left, int right, int k, int l, int r, T value)
    {
        if (r <= left || right <= l) return;
        if (left <= l && r <= right) item[k] = updateFunc(item[k], value);
        else
        {
            Update(left, right, Left(k), l, (l + r) / 2, value);
            Update(left, right, Right(k), (l + r) / 2, r, value);
        }
    }
    public T Query(int index)
    {
        index += _num - 1;
        var value = _func(_init, item[index]);
        while (index > 0)
        {
            index = Parent(index);
            value = _func(value, item[index]);
        }
        return value;
    }
    public T Query(int left, int right)
        => Query(left, right, 0, 0, _num);
    private T Query(int left, int right, int k, int l, int r)
    {
        if (r <= left || right <= l) return _init;
        if (left <= l && r <= right) return item[k];
        else
            return _func(Query(left, right, Left(k), l, (l + r) / 2), Query(left, right, Right(k), (l + r) / 2, r));
    }
}

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);
}