#include <bits/stdc++.h>
using namespace std;
int head[100010], nxt[100010 * 2], a[100010 * 2], edge, size[100010],
    sum[100010], value[100010], pre[100010], cur[100010];
int pos[100010], k, fac[100010], inv[100010], A[200010], B[200010], C[200010],
    rev[200010], omega[200010], res, n;
vector<int> p[100010 * 4];
pair<int, int> son[100010];
int read() {
  int tmp = 0;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') {
    tmp = tmp * 10 + c - '0';
    c = getchar();
  }
  return tmp;
}
void create(int u, int v) {
  edge++;
  a[edge] = v;
  nxt[edge] = head[u];
  head[u] = edge;
}
int calc_A(int n, int m) { return (long long)fac[n] * inv[n - m] % 998244353; }
int calc(int a, int k) {
  int ans = 1;
  while (k) {
    if (k % 2) ans = (long long)ans * a % 998244353;
    a = (long long)a * a % 998244353;
    k /= 2;
  }
  return ans;
}
void fft(int *a, int n) {
  for (int i = 0; i <= n - 1; i++)
    if (rev[i] > i) swap(a[i], a[rev[i]]);
  for (int l = 2; l <= n; l *= 2) {
    int m = l / 2;
    for (int *p = a; p != a + n; p += l)
      for (int i = 0; i <= m - 1; i++) {
        int tmp = (long long)p[i + m] * omega[n / l * i] % 998244353;
        p[i + m] = (p[i] - tmp + 998244353) % 998244353;
        p[i] = (p[i] + tmp) % 998244353;
      }
  }
}
void solve(int now, int l, int r) {
  p[now].clear();
  if (l == r) {
    p[now].push_back(1);
    p[now].push_back(value[l]);
    return;
  }
  int mid = (l + r) / 2, len1, len2;
  solve(now * 2, l, mid);
  solve(now * 2 + 1, mid + 1, r);
  len1 = mid - l + 1;
  len2 = r - mid;
  for (int i = 0; i <= len1; i++) A[i] = p[now * 2][i];
  for (int i = 0; i <= len2; i++) B[i] = p[now * 2 + 1][i];
  int tmp = 1, lg = 0;
  while (tmp <= len1 + len2) {
    tmp *= 2;
    lg++;
  }
  for (int i = 0; i <= tmp - 1; i++) {
    int cur = i;
    rev[i] = 0;
    for (int j = 1; j <= lg; j++) {
      rev[i] = rev[i] * 2 + cur % 2;
      cur /= 2;
    }
  }
  omega[0] = 1;
  omega[1] = calc(3, (998244353 - 1) / tmp);
  for (int i = 2; i <= tmp - 1; i++)
    omega[i] = (long long)omega[i - 1] * omega[1] % 998244353;
  fft(A, tmp);
  fft(B, tmp);
  omega[1] = calc(omega[1], 998244353 - 2);
  for (int i = 2; i <= tmp - 1; i++)
    omega[i] = (long long)omega[i - 1] * omega[1] % 998244353;
  for (int i = 0; i <= tmp - 1; i++) C[i] = (long long)A[i] * B[i] % 998244353;
  fft(C, tmp);
  int INV = calc(tmp, 998244353 - 2);
  for (int i = 0; i <= len1 + len2; i++)
    p[now].push_back((long long)C[i] * INV % 998244353);
  for (int i = 0; i <= tmp - 1; i++) A[i] = B[i] = C[i] = 0;
}
void dfs(int u, int fa) {
  size[u] = 1;
  for (int i = head[u]; i; i = nxt[i]) {
    int v = a[i];
    if (v != fa) {
      dfs(v, u);
      size[u] += size[v];
    }
  }
  int cnt = 0, tmp = 0, cnt_son = 0;
  for (int i = head[u]; i; i = nxt[i]) {
    int v = a[i];
    if (v != fa) {
      res = (res + (long long)tmp * sum[v] % 998244353) % 998244353;
      tmp = (tmp + sum[v]) % 998244353;
      son[++cnt_son] = make_pair(size[v], v);
      value[++cnt] = size[v];
    } else
      value[++cnt] = n - size[u];
  }
  solve(1, 1, cnt);
  for (int i = 0; i <= cnt; i++) pre[i] = p[1][i];
  sort(son + 1, son + cnt_son + 1);
  int g;
  for (int i = 1; i <= cnt_son; i++) {
    if (i == 1 || son[i].first != son[i - 1].first) {
      for (int j = 0; j <= cnt - 1; j++) {
        cur[j] = pre[j];
        if (j)
          cur[j] =
              ((cur[j] - (long long)cur[j - 1] * son[i].first % 998244353) %
                   998244353 +
               998244353) %
              998244353;
      }
      g = 0;
      for (int j = 0; j <= min(cnt - 1, k); j++) {
        if (k == 1 && j == 1) continue;
        g = (g + (long long)cur[j] * calc_A(k, j) % 998244353) % 998244353;
      }
    }
    res = (res + (long long)sum[son[i].second] * g % 998244353) % 998244353;
    sum[u] = (sum[u] + sum[son[i].second]) % 998244353;
  }
  g = 0;
  for (int j = 0; j <= cnt - 1; j++) {
    cur[j] = pre[j];
    if (j)
      cur[j] = ((cur[j] - (long long)cur[j - 1] * (n - size[u]) % 998244353) %
                    998244353 +
                998244353) %
               998244353;
  }
  for (int j = 0; j <= min(cnt - 1, k); j++) {
    if (k == 1 && j == 1) continue;
    g = (g + (long long)cur[j] * calc_A(k, j) % 998244353) % 998244353;
  }
  sum[u] = (sum[u] + g) % 998244353;
}
int main() {
  n = read();
  k = read();
  if (n == 1) {
    puts("0");
    return 0;
  }
  fac[0] = 1;
  for (int i = 1; i <= k; i++) fac[i] = (long long)fac[i - 1] * i % 998244353;
  inv[k] = calc(fac[k], 998244353 - 2);
  for (int i = k - 1; i >= 0; i--)
    inv[i] = (long long)inv[i + 1] * (i + 1) % 998244353;
  for (int i = 1; i <= n - 1; i++) {
    int u = read(), v = read();
    create(u, v);
    create(v, u);
  }
  dfs(1, 0);
  printf("%d\n", res);
  return 0;
}
