#include <bits/stdc++.h>
using namespace std;
const int N = 200002;
struct Node {
  int to;
  Node* next;
} nodes[N << 1], *pt = nodes, *buckets[N];
long long sum = 0;
int dp[N];
int cities;
int places;
int in1, in2;
void dps(int cur, int pre) {
  for (Node* i = buckets[cur]; i; i = i->next) {
    int next = (i->to);
    if (next == pre) continue;
    dps(next, cur);
    dp[cur] += dp[next];
  }
  sum += min(dp[cur], places - dp[cur]);
}
int main() {
  cin >> cities >> places;
  places <<= 1;
  for (int i = 0; i < places; i++) {
    cin >> in1;
    dp[in1] = 1;
  }
  for (; cities > 1; cities--) {
    cin >> in1 >> in2;
    pt->to = in1;
    pt->next = buckets[in2];
    buckets[in2] = pt++;
    pt->to = in2;
    pt->next = buckets[in1];
    buckets[in1] = pt++;
  }
  dps(1, 0);
  cout << sum;
  return 0;
}
