시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB57222117644.332%

문제

Kim, who wishes to start a business, is trying to open a dessert cafe he has been preparing after graduating from college. The road network in the town where Kim lives forms a tree structure, that is, a connected acyclic graph as shown in the figure below. There are n candidate sites for a dessert café in the town. In the figure below, a circle represents a candidate site for a dessert café, a line segment between two candidate sites represents a road, and the value labeled on a line segment represents the length of a road.

There are k apartment complexes in this town, so he wants his dessert café to be located as close as possible to an apartment complex. In above figure, there are three apartment complexes which are located to the candidate sites labeled by A, B, and C. Considering the competitiveness and profitability, he thinks that a candidate site satisfying the following condition is a good place.

Let d(x, y) be the length of the shortest path on a road network between two candidate sites x and y. A candidate site p is a good place if there exists a candidate site z where an apartment complex is located such that d(p, z) < d(q, z) for each candidate site q (≠ p).

In above figure, candidate sites 2, 4, 5, 6, 8, and 9 are good places. More specifically, for example, candidate 6 is a good place because it is closer to apartment complex B than any other candidate sites except for candidate 5, and is closer to apartment complex A than candidate 5. That is, there exists apartment complex B on candidate 5 satisfying d(6, 5) < d(q, 5) for q ∈ {1, 2, 3, 4, 7, 8, 9}, and there exists apartment complex A on candidate 2 satisfying d(6, 2) < d(5, 2). Candidate 7 is not a good place because none of apartment complexes are closer than candidate 6.

Given the information on candidate sites and apartment complexes in the town, write a program to output the number of good places.

입력

Your program is to read from standard input. The input starts with a line containing two integers, n and k (3 ≤ n ≤ 100,000 , 1 ≤ kn), where n is the number of candidate sites and k is the number of apartment complexes. The candidate sites are numbered from 1 to n. In the following n − 1 lines, each line contains three integers, i, j, and w (1 ≤ i,jn, 1 ≤ w ≤ 1,000), where i and j are candidate sites and w is the length of the road between i and j. The last line contains k integers which represent the locations of apartment complexes in the town.

출력

Your program is to write to standard output. Print exactly one line. The line should contain the number of good places.

예제 입력 1

9 3
1 2 8
2 4 7
4 3 6
4 6 4
5 6 3
6 7 2
6 9 5
9 8 6
2 5 8

예제 출력 1

6

예제 입력 2

4 4
1 2 1
1 3 1
1 4 1
2 4 1 3

예제 출력 2

4