#include <bits/stdc++.h>
using namespace std;
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;
template <class S, class T>
istream& operator>>(istream& is, pair<S, T>& p) {
  return is >> p.first >> p.second;
}
template <class T>
istream& operator>>(istream& is, vector<T>& xs) {
  for (auto& x : xs) is >> x;
  return is;
}
template <class S, class T>
ostream& operator<<(ostream& os, const pair<S, T>& p) {
  return os << p.first << " " << p.second;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& xs) {
  for (unsigned int i = 0; i < xs.size(); ++i) os << (i ? " " : "") << xs[i];
  return os;
}
template <class T>
void maxi(T& x, T y) {
  if (x < y) x = y;
}
template <class T>
void mini(T& x, T y) {
  if (x > y) x = y;
}
void debug(istringstream&) {}
template <char sep = ',', class Head, class... Tail>
void debug(istringstream& iss, Head&& head, Tail&&... tail) {
  string name;
  getline(iss, name, ',');
  cout << sep << name << "=" << head;
  debug(iss, forward<Tail>(tail)...);
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
const LL MOD = 1e9 + 7;
const int MAX = 100 + 10;
LL dp[MAX][MAX][2];
LL tmp[2][MAX][MAX];
int sz[MAX];
int init(VVI& G, int u, int p) {
  sz[u] = 1;
  for (int to : G[u]) {
    if (to == p) continue;
    sz[u] += init(G, to, u);
  }
  return sz[u];
}
LL solve(VVI& G, int u, int p, int k, int use) {
  LL& res = dp[u][k][use];
  if (res >= 0) return res;
  if (use == 0) {
    int ksum = 0;
    int crt = 0, nxt = 1;
    fill((LL*)tmp[crt][u], (LL*)tmp[crt][u] + MAX, 0);
    tmp[crt][u][0] = 1;
    for (int to : G[u]) {
      if (to == p) continue;
      fill((LL*)tmp[nxt][u], (LL*)tmp[nxt][u] + MAX, 0);
      for (int kk = 0; kk <= ksum; ++kk) {
        for (int k1 = 0; k1 + kk <= k && k1 <= sz[to]; ++k1) {
          (tmp[nxt][u][kk + k1] += tmp[crt][u][kk] * solve(G, to, u, k1, 0)) %=
              MOD;
          if (k1)
            (tmp[nxt][u][kk + k1] +=
             tmp[crt][u][kk] * solve(G, to, u, k1, 1)) %= MOD;
        }
      }
      ksum += sz[to];
      swap(crt, nxt);
    }
    res = tmp[crt][u][k];
  } else {
    int ksum = 1;
    int crt = 0, nxt = 1;
    fill((LL*)tmp[crt][u], (LL*)tmp[crt][u] + MAX, 0);
    tmp[crt][u][1] = 1;
    for (int to : G[u]) {
      if (to == p) continue;
      fill((LL*)tmp[nxt][u], (LL*)tmp[nxt][u] + MAX, 0);
      for (int kk = 0; kk <= ksum; ++kk) {
        for (int k1 = 0; k1 + kk <= k + 1 && k1 <= sz[to]; ++k1) {
          (tmp[nxt][u][kk + k1] += tmp[crt][u][kk] * solve(G, to, u, k1, 0)) %=
              MOD;
          if (k1) {
            (tmp[nxt][u][kk + k1 - 1] +=
             tmp[crt][u][kk] * solve(G, to, u, k1, 1)) %= MOD;
            (tmp[nxt][u][kk + k1] +=
             tmp[crt][u][kk] * solve(G, to, u, k1, 1)) %= MOD;
          }
        }
      }
      ksum += sz[to];
      swap(crt, nxt);
    }
    res = tmp[crt][u][k];
  }
  do {
    istringstream ss("u, k, use, res");
    debug<' '>(ss, u, k, use, res);
    cout << endl;
  } while (0);
  return res;
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int N, K;
  cin >> N >> K;
  VVI G(N);
  for (int i = (0); i < (N - 1); ++i) {
    int u, v;
    cin >> u >> v;
    --u;
    --v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  init(G, 0, -1);
  fill((LL*)dp, (LL*)dp + MAX * MAX * 2, -1);
  cout << solve(G, 0, -1, K, 0) << " " << solve(G, 0, -1, K, 1) << endl;
  return 0;
}
