CF514E.Darth Vader and Tree

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 nn sons, at that for each node, the distance between it an its ii -th left child equals to did_{i} . The Sith Lord loves counting the number of nodes in the tree that are at a distance at most xx 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+710^{9}+7 .

输入格式

The first line contains two space-separated integers nn and xx ( 1<=n<=105,0<=x<=1091<=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 nn space-separated integers did_{i} ( 1<=di<=1001<=d_{i}<=100 ) — the length of the edge that connects each node with its ii -th child.

输出格式

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

输入输出样例

  • 输入#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)

首页