#include <bits/stdc++.h>
using namespace std;
const int N = 200001;
long long int sz[N], dist[N], every[N];
vector<int> adj[N];
int n, k;
void dfs(int start, int p = -1) {
  for (auto child : adj[start]) {
    if (child != p) {
      dfs(child, start);
      sz[start] += sz[child];
      dist[start] += dist[child] + sz[child];
    }
  }
}
void dfs1(int start, int p = -1) {
  for (auto child : adj[start]) {
    if (child != p) {
      every[child] = every[start] + (2 * k - 2 * sz[child]);
      dfs1(child, start);
    }
  }
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < 2 * k; i++) {
    int x;
    scanf("%d", &x);
    sz[x]++;
  }
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1);
  every[1] = dist[1];
  dfs1(1);
  long long int ans = dist[1];
  for (int i = 1; i <= n; i++) {
    ans = min(ans, every[i]);
  }
  printf("%lld\n", ans);
  return 0;
}
