#![allow(unused_imports)]
#![allow(unused_macros)]
use std::cmp::{ min, max };

macro_rules! ewriteln {
    ($($args:expr),*) => {
        let _ = writeln!(&mut std::io::stderr(), $($args),*);
    };
}
macro_rules! trace {
    ($var:expr) => { ewriteln!(">>> {} = {:?}", stringify!($var), $var); };
    ($($args:expr),*) => { trace!(($($args),*)) }
}
macro_rules! put {
    ($var:expr) => { ewriteln!("{}", $var); };
    ($var:expr, $($args:expr),*) => { eprintln!("{} ", $var); put!($($args),*); };
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let k: usize = sc.cin();
    // trace!(n,k);
    let xs: Vec<usize> = (0..n).map(|_|sc.cin()).collect();
    let mut dp: Vec<Vec<i64>> = vec![vec![0; 100000+10]; 102];
    dp[0][0] = 1;
    for i in 0..n {
        for j in 0..100002 {
            dp[i+1][j] += dp[i][j];
            if j+xs[i]+1 < dp[0].len(){
                dp[i+1][j+xs[i]+1] -= dp[i][j];
            }
        }
        let mut ac = 0;
        for j in 0..100002 {
            ac += dp[i+1][j];
            ac = (ac + M) % M;
            dp[i+1][j] = ac;
        }
    }
    put!(dp[n][k]);
}

use std::io::{ self, Write };
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Scanner { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        match self.buffer.pop_front().unwrap().parse::<T>() {
            Ok(a) => a,
            Err(_) => panic!("parse err")
        }
    }
}
