Under construction

Still being built. Things may change

Ramen Delivery

Time limit1sMemory limit1024 MB

Summary
Given a tree rooted at room 1, sum over every K-subset of rooms the minimum walk time from room 1 that visits all of them, modulo 10^9+7.
Level

Medium7 of 10

Topics
Tree, DFS, Combinatorics
Solved
No attempts yet

Problem

The dormitory of Seoul Science High School can be represented as a tree with NN rooms and N−1N-1 corridors, where each corridor connects two different rooms. Every corridor can be traveled in both directions, and you can move between any two rooms through the corridors. Passing through one corridor takes 11 unit of time.

Mingyu wants to make instant ramen for KK friends. Mingyu is currently in room 11, and Mingyu and all of the friends are in different rooms.

To do this, Mingyu will deliver hot water to every friend. Hot water is available only from the dispenser in room 11. Mingyu has a very large thermos, so one fill is enough to supply every friend.

Cooking ramen is risky. If the dormitory supervisor catches it, Mingyu can receive demerit points. To reduce the risk, Mingyu will visit the KK rooms so that the time at which the last hot water is delivered is as early as possible.

The way Mingyu visits the KK rooms is described below.

  • Before receiving water, Mingyu checks in advance the rooms where the KK friends are.
  • Mingyu gets water in room 11 at time 00 and sets out. Mingyu visits the KK rooms in a way that minimizes the time at which the friend who receives the last hot water gets it.
  • Only the time Mingyu spends walking through corridors is counted. The time to hand out water and the time to fill it at the dispenser are ignored. The time Mingyu takes to return to his own room after giving out all the water is also ignored.

Before checking which rooms the friends are in, Mingyu wants to predict how long the delivery will take. For each of the (N−1K)\binom{N-1}{K} ways to choose the rooms where the KK friends are, add up the time at which the last hot water is delivered.

Input

The first line contains the number of rooms NN and the number of friends KK, separated by a space.

From the second line through the NNth line, the (i+1)(i+1)th line contains the numbers UiU_i and ViV_i of the two rooms connected by corridor ii, separated by a space.

Output

Print the sum of the times at which the last hot water is delivered over all (N−1K)\binom{N-1}{K} ways to choose the rooms of the KK friends, modulo 109+710^9 + 7.

Constraints

  • 2≤N≤1052 \le N \le 10^5
  • 1≤K≤N−11 \le K \le N-1
  • 1≤Ui≤N1 \le U_i \le N (1≤i<N)(1 \le i < N)
  • 1≤Vi≤N1 \le V_i \le N (1≤i<N)(1 \le i < N)
  • Ui≠ViU_i \ne V_i (1≤i<N)(1 \le i < N)
  • The input is guaranteed to describe a tree.

Examples3

  1. Example 1

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

    Input
    7 6
    1 2
    2 3
    2 4
    4 5
    4 6
    1 7
    
    Expected output
    9
    
  3. Example 3

    Input
    10 5
    1 2
    2 3
    2 4
    4 5
    4 6
    5 7
    1 8
    8 9
    8 10
    
    Expected output
    1210