import java.util.*

fun main(args: Array<String>) {
    val scan = FastScanner()
    val n = scan.nextInt()
    val k = scan.nextInt()
    val ab = Array(n-1){Pair(scan.nextInt()-1, scan.nextInt()-1)}
    graph = Array(n){ mutableListOf<Int>()}
    for ((a, b) in ab) {
        graph!![a].add(b)
        graph!![b].add(a)
    }

    comb = Comb(k + 1)
    println(rec(0, -1, k).n)
}

var graph: Array<MutableList<Int>>? = null
var comb: Comb? = null

fun rec(cur: Int, pre: Int, k: Int): Co {
    val nk = if (pre == -1) k else k-2
    val c = if (pre == -1) graph!![cur].size + 1 else graph!![cur].size - 1
    var ret = co(comb!!.perm(nk, c))
    for (v in graph!![cur]) {
        if (pre == v) continue
        ret *= rec(v, cur, k)
    }
    return ret
}

private val M = 1000000007L

class Comb(size: Int){
    val fac = LongArray(size){0}
    val finv = LongArray(size){0}
    val inv = LongArray(size){0}

    init {
        fac[0] = 1
        fac[1] = 1
        finv[0] = 1
        finv[1] = 1
        inv[1] = 1
        for (i in 2 until size) {
            fac[i] = fac[i-1] * i % M
            inv[i] = M - inv[(M % i).toInt()] * (M / i) % M
            finv[i] = finv[i-1] * inv[i] % M
        }
    }

    fun of(n: Int, k: Int): Long {
        return if (n < k) 0 else fac[n] * (finv[k] * finv[n - k] % M) % M
    }

    fun rep(n: Int, k: Int): Long {
        return of(n+k-1, k)
    }

    fun perm(n: Int, k: Int): Long {
        return if (n < k) 0 else fac[n] * finv[n-k] % M
    }
}

fun co(n: Long) = Co((n % M + M) % M)

data class Co(val n: Long) {
    operator fun plus(other: Co): Co {
        return co(n + other.n)
    }
    operator fun minus(other: Co): Co {
        return co(n - other.n)
    }
    operator fun times(other: Co): Co {
        return co(n * other.n)
    }
    operator fun div(other: Co): Co {
        return this * other.pow(M - 2)
    }
    fun pow(k_: Long): Co {
        var k = k_
        var a = this
        var res = co(1)
        while (k > 0) {
            if (k.and(1) == 1L) {
                res *= a
            }
            a *= a
            k = k.shr(1)
        }
        return res
    }
}

class FastScanner {
    private val printable = 33..126
    val `in` = System.`in`
    val buffer = ByteArray(1024)
    var ptr = 0
    var buflen = 0
    fun hasNextByte(): Boolean {
        if (ptr < buflen) {
            return true
        } else {
            ptr = 0
            buflen = `in`.read(buffer)
            if (buflen <= 0) {
                return false
            }
        }
        return true
    }
    fun readByte(): Byte {
        return if (hasNextByte()) buffer[ptr++] else return -1
    }
    fun hasNext(): Boolean {
        while (hasNextByte() && buffer[ptr] !in printable) ptr++
        return hasNextByte()
    }
    fun next(): String {
        if (!hasNext()) throw NoSuchElementException()
        val sb = StringBuilder()
        var b = readByte()
        while (b in printable) {
            sb.appendCodePoint(b.toInt())
            b = readByte()
        }
        return sb.toString()
    }
    fun nextLong(): Long {
        if (!hasNext()) throw NoSuchElementException()
        var n = 0L
        var minus = false
        var b = readByte()
        if (b == '-'.toByte()) {
            minus = true
            b = readByte()
        }
        if (b !in '0'.toByte()..'9'.toByte()) {
            throw NumberFormatException()
        }
        while (true) {
            if (b in '0'.toByte()..'9'.toByte()) {
                n *= 10
                n += b - '0'.toByte()
            } else if (b == (-1).toByte() || b !in printable) {
                return if (minus) -n else n
            } else {
                throw NumberFormatException()
            }
            b = readByte()
        }
    }
    fun nextInt(): Int {
        val nl = nextLong()
        if (nl !in Integer.MIN_VALUE..Integer.MAX_VALUE) throw NumberFormatException()
        return nl.toInt()
    }
    fun nextDouble(): Double {
        return next().toDouble()
    }
}

Measured memory_bytes: 77872