#P4846. Darth Vader and Tree

    ID: 2384 传统题 2000ms 256MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>动态规划数学矩阵乘法CodeForces

Darth Vader and Tree

Darth Vader and Tree

题面翻译

有一个无限大的有根树,树上的每一个节点都有 nn 个子节点(1n1051 \leq n \leq 10^5),任意一个节点它的第 ii 个子节点之间的距离为 did_i1di1001 \leq d_i \leq 100)。

给出一个数 xx0x1090 \leq x \leq 10^9),求有多少个节点到根节点的距离小于等于 xx,输出答案对 109+710^9+7 取模后的结果。

题目描述

When Darth Vader gets bored, he sits down on the sofa, closes his eyes and thinks of an infinite rooted tree where each node has exactly n n sons, at that for each node, the distance between it an its i i -th left child equals to di d_{i} . The Sith Lord loves counting the number of nodes in the tree that are at a distance at most x x from the root. The distance is the sum of the lengths of edges on the path between nodes.

But he has got used to this activity and even grew bored of it. 'Why does he do that, then?' — you may ask. It's just that he feels superior knowing that only he can solve this problem.

Do you want to challenge Darth Vader himself? Count the required number of nodes. As the answer can be rather large, find it modulo 109+7 10^{9}+7 .

输入格式

The first line contains two space-separated integers n n and x x ( 1<=n<=105,0<=x<=109 1<=n<=10^{5},0<=x<=10^{9} ) — the number of children of each node and the distance from the root within the range of which you need to count the nodes.

The next line contains n n space-separated integers di d_{i} ( 1<=di<=100 1<=d_{i}<=100 ) — the length of the edge that connects each node with its i i -th child.

输出格式

Print a single number — the number of vertexes in the tree at distance from the root equal to at most x x .

样例 #1

样例输入 #1

3 3
1 2 3

样例输出 #1

8

提示

Pictures to the sample (the yellow color marks the nodes the distance to which is at most three)