# returns weight sum from s to t
# assumed e is tree, bidirected directed graph
# TLE with max 100000
def bfs(s,e,k)
	mod = 10**9+7
	childs = Array.new(E.size){0}
	searched = Array.new(E.size){false}
	comb = k
	childs[s] = 0
	searched[s] = 0
	# [node, level]
	# q = e[s].map{|a| [a,s,1]}
	q = []
	e[s].each{|a| 
		q << [a,s,1]
	}
	while(!q.empty?)
		# p q
		v,v_p,lev = q.shift
		# p searched
		next if (searched[v])
		# p [v,v_p,lev]
		# calc
		return 0 if((k-[lev,2].min-childs[v_p])<=0)
		# p "*= is #{k-[lev,2].min-childs[v_p]}"
		# p "#{comb*(k-[lev,2].min-childs[v_p])}"
		comb = comb * (k-[lev,2].min-childs[v_p])
		comb %= mod
		childs[v_p] += 1		
		searched[v] = true
		# next
		v_nxt = e[v].each{|i| 
			q << [i,v,lev+1]
		}
		# p comb
	end
	return comb
end
N,K=gets.chomp.split(' ').map{|n| n.to_i}
# 0 indexed
E = Array.new(N){[]}
1.upto(N-1){
	p=gets.chomp.split(' ').map{|n| n.to_i}
	p[0] -= 1
	p[1] -= 1
	E[p[0]].push(p[1])
	E[p[1]].push(p[0])
}
puts bfs(0,E,K)
