#include using namespace std; long dynamic_programming(const long now, const long prev, vector>& dp, const vector>& edge){ if(edge[now].size() == 1){ dp[now][0] = dp[now][1] = 1; return 1; } auto tapi = [](vector& to, const vector& src) -> void{ size_t N = to.size(); vector hoge(N); for(int i = 0; i < N; ++i) for(int j = 0; j <= i; ++j)hoge[i] += src[j] * to[i - j]; copy(hoge.begin(), hoge.end(), to.begin()); }; long ret = 0; dp[now][0] = 1; for(const auto i : edge[now]) if(i != prev) ret += dynamic_programming(i, now, dp, edge); for(const auto i : edge[now]) if(i != prev) tapi(dp[now], dp[i]); if(ret + 1 < dp[now].size())dp[now][ret + 1] = 1; return ret + 1; } int main(){ unsigned long N, K; cin >> N >> K; vector> edge(N); for(int i = 1, a, b; i < N; ++i){ cin >> a >> b; edge[a].push_back(b); edge[b].push_back(a); } vector> dp(N, vector(K + 1)); dynamic_programming(0, 0, dp, edge); cout << dp[0][K] << endl; }