Kefa and Park
Kefa decided to celebrate his first big salary by going to a restaurant.
He lives near an unusual park. The park is a rooted tree with vertices, rooted at vertex . Kefa's house is located at vertex as well. Unfortunately for our hero, the park is inhabited by cats, and Kefa has already identified the vertices where the cats are located.
The leaf vertices of the park contain restaurants. Kefa wants to choose a restaurant, but he is very afraid of cats. Therefore, he will not go to a restaurant if, on the path from his house to the restaurant, he encounters more than consecutive vertices with cats.
Your task is to help Kefa count the number of restaurants he can safely visit.
Input
The first line contains two integers and — the number of vertices in the tree and the maximum number of consecutive vertices with cats that Kefa can tolerate.
The second line contains integers , where each is either (there is no cat at vertex ) or (there is a cat at vertex ).
The following lines contains the tree's edges in the format , where and are vertices connected by an edge.
It is guaranteed that this set of edges forms a tree.
Output
Print the number of leaf vertices that Kefa can reach if there are no more than consecutive vertices with cats on the way from his house.