function Main(input) {
	let C = 1e9 + 7;
	input = input.trim().split("\n").map(function(x) { return x.split(" ")});
	let N = parseInt(input[0][0], 10);
	let K = parseInt(input[0][1], 10);
	let a = input[1].map(e => parseInt(e, 10));
	a.sort((a, b) => b - a);
	for (let i = N - 1; i >= 0; i--){
		if (a[i] === 0) a.pop();
		else break;
	}
	if (a.length === 0) {
		if (K === 0 ) console.log(1);
		else console.log(0);
		return;
	}
	a.reverse();

	let DP = Array.from({length: a.length}, () => []);
	let capacityMax = Math.min(a[0], K);
	DP[0].push(1);
	for (let j = 0; j < capacityMax; j++){
		DP[0].push(1);
	}
	let ruisekiwa = [0];
	let tmp;
	for (let i = 1; i < DP.length; i++){
		capacityMax += a[i];
		capacityMax = Math.min(capacityMax, K);
		// console.log(capacityMax);
		for (let j = 0; j < DP[i - 1].length; j++){
			ruisekiwa[j + 1] = ruisekiwa[j] + DP[i - 1][j];
			ruisekiwa[j + 1] %= C;
		}
		// console.log("r", ruisekiwa);

		for (let j = 0; j < a[i]; j++){
			DP[i].push(ruisekiwa[Math.min(ruisekiwa.length - 1, j + 1)]);
		}
		
		for (let j = a[i]; j <= capacityMax; j++){
			tmp = Math.min(ruisekiwa.length - 1, j + 1);
			DP[i].push(mod(ruisekiwa[tmp] - ruisekiwa[j - a[i]], C));
		}
		// console.log(DP);
	}
	// console.log(DP);
	let line = DP.pop();
	if (line.length <= K) {
		console.log(0);
	} else {
		console.log(line[K]);
	}

}

function mod(i, j) {
    return (i % j) < 0 ? (i % j) + 0 + (j < 0 ? -j : j) : (i % j + 0);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
