#include <bits/stdc++.h>
using namespace std;
const signed int MAX = 2e5 + 5;
bool university[MAX];
bool visited[MAX];
vector<signed int> tree[MAX];
signed int uni_count[MAX];
void dfs(signed int u) {
  visited[u] = 1;
  signed int c = university[u];
  for (typeof((tree[u]).begin()) itr = (tree[u]).begin();
       itr != (tree[u]).end(); itr++) {
    signed int v = *itr;
    if (!visited[v]) {
      dfs(v);
      c += uni_count[v];
    }
  }
  uni_count[u] = c;
}
signed int main() {
  signed int n, k;
  scanf("%d %d", &n, &k);
  signed int u, v;
  for (signed int i = 0; i < (k << 1); ++i) {
    scanf("%d", &u);
    university[u] = 1;
  }
  for (signed int i = 0; i < (n - 1); ++i) {
    scanf("%d %d", &u, &v);
    tree[u].push_back(v);
    tree[v].push_back(u);
  }
  dfs(1);
  signed int tmp = k << 1;
  signed long long ans = 0;
  for (signed int i = (1); i <= (n); ++i)
    ans += min(uni_count[i], tmp - uni_count[i]);
  printf("%I64d\n", ans);
  return 0;
}
