Kefa decided to celebrate his first big salary by going to the restaurant. 

He lives by an unusual park. The park is a rooted tree consisting of *n* vertices with the root at vertex 1. Vertex 1 also contains Kefa's house. Unfortunaely for our hero, the park also contains cats. Kefa has already found out what are the vertices with cats in them.

The leaf vertices of the park contain restaurants. Kefa wants to choose a restaurant where he will go, but unfortunately he is very afraid of cats, so there is no way he will go to the restaurant if the path from the restaurant to his house contains more than *m* consecutive vertices with cats. 

Your task is to help Kefa count the number of restaurants where he can go.
The first line contains two integers, *n* and *m* (2 ≤ *n* ≤ 10<sup class="upper-index">5</sup>, 1 ≤ *m* ≤ *n*) — the number of vertices of the tree and the maximum number of consecutive vertices with cats that is still ok for Kefa.

The second line contains *n* integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub>, where each *a*<sub class="lower-index">*i*</sub> either equals to 0 (then vertex *i* has no cat), or equals to 1 (then vertex *i* has a cat).

Next *n* - 1 lines contains the edges of the tree in the format "*x*<sub class="lower-index">*i*</sub> *y*<sub class="lower-index">*i*</sub>" (without the quotes) (1 ≤ *x*<sub class="lower-index">*i*</sub>, *y*<sub class="lower-index">*i*</sub> ≤ *n*, *x*<sub class="lower-index">*i*</sub> ≠ *y*<sub class="lower-index">*i*</sub>), where *x*<sub class="lower-index">*i*</sub> and *y*<sub class="lower-index">*i*</sub> are the vertices of the tree, connected by an edge. 

It is guaranteed that the given set of edges specifies a tree.
# Kefa and Park

# Input
n, m = map(int, input().split())
# List of nodes with cats
cat_nodes = list(map(int, input().split()))
# List of edges
edges = []
for i in range(n - 1):
    k, v = map(int, input().split())
    edges.append((k, v))

# Create a dictionary to store the adjacency list of the tree
tree = {}
for edge in edges:
    if edge[0] not in tree:
        tree[edge[0]] = []
    tree[edge[0]].append(edge[1])
    if edge[1] not in tree:
        tree[edge[1]] = []
    tree[edge[1]].append(edge[0])

# Create a queue to store the nodes to be visited
queue = [(1, 0, 0)]
# visited: A set to store the visited nodes
visited = set()

# Initialize the counter for the number of reachable restaurants
reachable_restaurants = 0

# While the queue is not empty
while queue:
    # Get the current node, the current cost, and the previous node
    current_node, current_cost, previous_node = queue.pop(0)

    # Mark the current node as visited
    visited.add(current_node)

    # If the current node is a leaf node and the current cost is less than or equal to the maximum cost
    if current_node not in tree and current_cost <= m:
        # Increment the counter for the number of reachable restaurants
        reachable_restaurants += 1

    # For each neighbor of the current node
    for neighbor in tree[current_node]:
        # If the neighbor has not been visited
        if neighbor not in visited:
            # Add the neighbor to the queue with the updated cost and previous node
            queue.append((neighbor, current_cost + 1 if cat_nodes[neighbor] == 1 else current_cost, current_node))

# Print the number of reachable restaurants
print(reachable_restaurants)
