#include <bits/stdc++.h>
using namespace std;
vector<long long> g[200001];
bool visited[200001] = {0};
bool visited1[200001] = {0};
long long count1 = 0;
long long c[200001] = {0};
long long k;
void dfs(long long x) {
  visited[x] = 1;
  for (int i = 0; i < g[x].size(); i++) {
    if (visited[g[x][i]] == 0) {
      dfs(g[x][i]);
      c[x] += c[g[x][i]];
    }
  }
}
void dfs1(long long x) {
  visited1[x] = 1;
  for (int i = 0; i < g[x].size(); i++) {
    if (visited1[g[x][i]] == 0) {
      count1 = count1 + min(c[g[x][i]], 2 * k - c[g[x][i]]);
      dfs1(g[x][i]);
    }
  }
}
int main() {
  long long n;
  cin >> n >> k;
  long long a[2 * k + 1];
  for (int i = 1; i <= 2 * k; i++) {
    cin >> a[i];
    c[a[i]] = 1;
  }
  for (int i = 1; i <= n - 1; i++) {
    long long x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  dfs(1);
  dfs1(1);
  cout << count1;
  return 0;
}
