#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int N = 200005;
int son[N] = {0}, dd[N] = {0}, d[N] = {0}, top[N] = {0}, ye = 0;
vector<int> my[N];
void dfs1(int x) {
  int i = 0, y = 0, now = 0;
  son[x] = -1;
  dd[x] = 1;
  for (i = 0; i < my[x].size(); i++) {
    y = my[x][i];
    if (d[y]) continue;
    d[y] = d[x] + 1;
    dfs1(y);
    now = dd[y] + 1;
    if (now > dd[x]) {
      dd[x] = now;
      son[x] = y;
    }
  }
  if (dd[x] == 1) {
    ye++;
  }
}
void dfs2(int x, int r, int t) {
  top[x] = t;
  int i = 0, y = 0;
  for (i = 0; i < my[x].size(); i++) {
    y = my[x][i];
    if (y == r) continue;
    if (son[x] == y) {
      dfs2(y, x, t);
    } else {
      dfs2(y, x, y);
    }
  }
}
void solve() {
  int i = 0, n = 0, m = 0, p = 0, q = 0, you = 0;
  long long ans = 0, now = 0;
  vector<int> a;
  scanf("%d%d", &n, &m);
  for (i = 1; i < n; i++) {
    scanf("%d%d", &p, &q);
    my[p].push_back(q);
    my[q].push_back(p);
  }
  d[1] = 1;
  dfs1(1);
  if (m >= ye) {
    for (i = ye; i <= m; i++) {
      now = (n - i) * 1LL * i;
      if (now > ans) ans = now;
    }
    printf("%lld\n", ans);
    return;
  }
  dfs2(1, 0, 1);
  for (i = 1; i <= n; i++) {
    if (dd[i] == 1) {
      a.push_back(-d[i] + d[top[i]] - 1);
    }
  }
  sort(a.begin(), a.end());
  for (i = 0; i < m; i++) {
    you -= a[i];
  }
  ans = (you - m) * 1LL * (m - (n - you));
  for (i = 0; i <= n - you; i++) {
    now = (n - m - i) * 1LL * (m - i);
    if (now < ans) ans = now;
  }
  printf("%lld\n", ans);
}
int main() {
  int o = 1;
  while (o--) {
    solve();
  }
  return 0;
}

### Prompt

Construct a cpp code solution to the problem outlined:

Two players, Red and Blue, are at it again, and this time they're playing with crayons! The mischievous duo is now vandalizing a rooted tree, by coloring the nodes while playing their favorite game.

The game works as follows: there is a tree of size n, rooted at node 1, where each node is initially white. Red and Blue get one turn each. Red goes first. 

In Red's turn, he can do the following operation any number of times: 

  * Pick any subtree of the rooted tree, and color every node in the subtree red. 

However, to make the game fair, Red is only allowed to color k nodes of the tree. In other words, after Red's turn, at most k of the nodes can be colored red.

Then, it's Blue's turn. Blue can do the following operation any number of times: 

  * Pick any subtree of the rooted tree, and color every node in the subtree blue. However, he's not allowed to choose a subtree that contains a node already colored red, as that would make the node purple and no one likes purple crayon. 

Note: there's no restriction on the number of nodes Blue can color, as long as he doesn't color a node that Red has already colored.

After the two turns, the score of the game is determined as follows: let w be the number of white nodes, r be the number of red nodes, and b be the number of blue nodes. The score of the game is w ⋅ (r - b).

Red wants to maximize this score, and Blue wants to minimize it. If both players play optimally, what will the final score of the game be?

Input

The first line contains two integers n and k (2 ≤ n ≤ 2 ⋅ 10^5; 1 ≤ k ≤ n) — the number of vertices in the tree and the maximum number of red nodes.

Next n - 1 lines contains description of edges. The i-th line contains two space separated integers u_i and v_i (1 ≤ u_i, v_i ≤ n; u_i ≠ v_i) — the i-th edge of the tree.

It's guaranteed that given edges form a tree.

Output

Print one integer — the resulting score if both Red and Blue play optimally.

Examples

Input


4 2
1 2
1 3
1 4


Output


1


Input


5 2
1 2
2 3
3 4
4 5


Output


6


Input


7 2
1 2
1 3
4 2
3 5
6 3
6 7


Output


4


Input


4 1
1 2
1 3
1 4


Output


-1

Note

In the first test case, the optimal strategy is as follows: 

  * Red chooses to color the subtrees of nodes 2 and 3. 
  * Blue chooses to color the subtree of node 4. 

At the end of this process, nodes 2 and 3 are red, node 4 is blue, and node 1 is white. The score of the game is 1 ⋅ (2 - 1) = 1.

In the second test case, the optimal strategy is as follows: 

  * Red chooses to color the subtree of node 4. This colors both nodes 4 and 5. 
  * Blue does not have any options, so nothing is colored blue. 

At the end of this process, nodes 4 and 5 are red, and nodes 1, 2 and 3 are white. The score of the game is 3 ⋅ (2 - 0) = 6.

For the third test case:

<image>

The score of the game is 4 ⋅ (2 - 1) = 4.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int N = 200005;
int son[N] = {0}, dd[N] = {0}, d[N] = {0}, top[N] = {0}, ye = 0;
vector<int> my[N];
void dfs1(int x) {
  int i = 0, y = 0, now = 0;
  son[x] = -1;
  dd[x] = 1;
  for (i = 0; i < my[x].size(); i++) {
    y = my[x][i];
    if (d[y]) continue;
    d[y] = d[x] + 1;
    dfs1(y);
    now = dd[y] + 1;
    if (now > dd[x]) {
      dd[x] = now;
      son[x] = y;
    }
  }
  if (dd[x] == 1) {
    ye++;
  }
}
void dfs2(int x, int r, int t) {
  top[x] = t;
  int i = 0, y = 0;
  for (i = 0; i < my[x].size(); i++) {
    y = my[x][i];
    if (y == r) continue;
    if (son[x] == y) {
      dfs2(y, x, t);
    } else {
      dfs2(y, x, y);
    }
  }
}
void solve() {
  int i = 0, n = 0, m = 0, p = 0, q = 0, you = 0;
  long long ans = 0, now = 0;
  vector<int> a;
  scanf("%d%d", &n, &m);
  for (i = 1; i < n; i++) {
    scanf("%d%d", &p, &q);
    my[p].push_back(q);
    my[q].push_back(p);
  }
  d[1] = 1;
  dfs1(1);
  if (m >= ye) {
    for (i = ye; i <= m; i++) {
      now = (n - i) * 1LL * i;
      if (now > ans) ans = now;
    }
    printf("%lld\n", ans);
    return;
  }
  dfs2(1, 0, 1);
  for (i = 1; i <= n; i++) {
    if (dd[i] == 1) {
      a.push_back(-d[i] + d[top[i]] - 1);
    }
  }
  sort(a.begin(), a.end());
  for (i = 0; i < m; i++) {
    you -= a[i];
  }
  ans = (you - m) * 1LL * (m - (n - you));
  for (i = 0; i <= n - you; i++) {
    now = (n - m - i) * 1LL * (m - i);
    if (now < ans) ans = now;
  }
  printf("%lld\n", ans);
}
int main() {
  int o = 1;
  while (o--) {
    solve();
  }
  return 0;
}

```