import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n,k] <- getIntList
    ab <- replicateM (n-1) $ do
        [a,b] <- getIntList
        return (a-1,b-1)
    let edge = V.create $ do
           vec <- VM.replicate n []
           forM_ ab $ \(a,b) -> do
               VM.modify vec (a:) b
               VM.modify vec (b:) a
           return vec
    
    let result = VU.create $ do
            vec <- VUM.replicate n 0
            VUM.write vec 0 k
            let next = edge V.! 0
            forM_ (zip [k-1,k-2..] next) $ \(c,i) -> VUM.write vec i c
            let go [] = return ()
                go ((par,this):qs) = do
                    let children = filter (/= par) $ edge V.! this
                    forM_ (zip [k-2,k-3..] children) $ \(c,i) -> VUM.write vec i c
                    go (map (\i -> (this,i)) children)
                    go qs
            go (map (\i -> (0,i)) next)
            return vec

    let ans = VU.foldl' f 1 result
         where f a b | a >= 0 && b >= 0 = (a * b) `mod` 1000000007
                     | otherwise = 0
    print ans