题目描述
Problem Description
There is a tree with $n$ nodes, numbered from $1$ to $n$. Each node of the tree has a color represented by $col_i$. Different values of $col_i$ denote different colors.
Xiao L wants to use this tree to make many Christmas trees. A tree can be made into a Christmas tree if and only if it has at least $k$ different colors. Xiao L plans to divide the tree into several disjoint connected blocks and select those blocks that meet the condition to make Christmas trees.
Given the structure of the tree, how many Christmas trees can be made at most?
Input Format
The first line of input contains two positive integers $n$ and $k$ ($1 \le k \le n \le 2 \times 10^5$), separated by a space.
The second line contains $n$ positive integers $col_i$ ($1 \le col_i \le n$), representing the color of node $i$, separated by spaces.
The next $n-1$ lines each contain two positive integers $x$ and $y$ ($1 \le x, y \le n$, $x \neq y$), representing the two endpoints of an edge in the tree, separated by a space.
Output Format
Output a single integer on one line, representing the maximum number of Christmas trees that can be made.
Sample Input and Output
Sample Input #1
4 2
1 2 3 4
1 2
1 3
1 4
Sample Output #1
1
Sample Input #2
4 2
1 2 3 4
1 2
2 3
3 4
Sample Output #2
2
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分