Under construction

Still being built. Things may change

Quarantine

Time limit2sMemory limit256 MB

Summary
Count the sets of cities to lock on a tree so that no simple path with at least K roads joins two unlocked cities, modulo 10^9+7.
Level

Hard8 of 10

Topics
Tree, Dynamic programming, Divide and conquer
Solved
No attempts yet

Problem

Seolgwak is a country of NN cities numbered from 1 to NN. Exactly N−1N-1 roads connect pairs of cities, and every city is reachable from every other city. Every road has length 11.

Recently, a new virus that spread from the neighboring country Gyeonggwak has become widespread in Seolgwak. Minister of Health and Welfare Geunyeong believes that long-distance travel is the largest cause of the virus spreading. She plans to lock down some cities and close the roads connected to the locked cities.

For Geunyeong, a long-distance trip is a trip whose travel distance is at least KK and that does not pass through the same city more than once.

For example, suppose K=3K = 3 and the cities and roads are shaped as in the figure below.

A possible long-distance trip is the route that passes through cities 1, 2, 3, and 6 in order, or the route that passes through cities 5, 3, 6, and 7 in order. There are many other long-distance trips besides these.

If city 3 is locked, no route that avoids passing through the same city twice has length greater than 2, so long-distance travel becomes impossible. Locking every city also makes long-distance travel impossible.

Geunyeong wants to lock an appropriate set of cities so that long-distance travel is impossible. Count the number of ways to lock cities so that long-distance travel is impossible.

Input

The first line contains the number of cities NN and the positive integer KK that Geunyeong has in mind. (1≤K≤N≤3000001 \le K \le N \le 300000)

From the second line through the NN-th line, each line contains two positive integers xx and yy (1≤x,y≤N1 \le x, y \le N). This means a road connects city xx and city yy.

Output

On the first line, print the number of ways to lock cities so that long-distance travel is impossible, modulo 109+710^9+7.

Examples3

  1. Example 1

    Input
    4 1
    1 2
    2 3
    3 4
    
    Expected output
    8
    
  2. Example 2

    Input
    5 3
    1 2
    1 3
    1 4
    1 5
    
    Expected output
    32
    
  3. Example 3

    Input
    7 3
    1 2
    2 3
    2 4
    3 6
    3 5
    6 7
    
    Expected output
    104