#include <bits/stdc++.h>
using namespace std;
vector<vector<long long> > g;
long long N, K;
long long col[200100];
long long m[200100];
long long dfs_cnt(long long n, long long p) {
  if (m[n] != -1) {
    return m[n];
  }
  long long tot = 0;
  if (col[n]) tot++;
  for (long long x = 0; x < g[n].size(); x++) {
    if (g[n][x] != p) {
      tot += dfs_cnt(g[n][x], n);
    }
  }
  return m[n] = tot;
}
long long dfs(long long n, long long p) {
  long long totc = 0;
  for (long long x = 0; x < g[n].size(); x++) {
    if (g[n][x] != p) {
      if (dfs_cnt(g[n][x], n) > K) {
        return dfs(g[n][x], n);
      }
    }
  }
  return n;
}
pair<long long, long long> dfs_dist(long long n, long long p) {
  long long tot = 0, uni = 0;
  for (long long x = 0; x < g[n].size(); x++) {
    if (g[n][x] != p) {
      pair<long long, long long> r = dfs_dist(g[n][x], n);
      tot += r.first + r.second;
      uni += r.second;
    }
  }
  if (col[n]) uni++;
  return {tot, uni};
}
int main() {
  iostream::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> K;
  long long u;
  memset(col, 0, sizeof(col));
  memset(m, -1, sizeof(m));
  for (long long k = 0; k < 2 * K; k++) {
    cin >> u;
    col[u] = 1;
  }
  long long A, B;
  g.assign(N + 1, vector<long long>());
  for (long long n = 1; n < N; n++) {
    cin >> A >> B;
    g[A].push_back(B);
    g[B].push_back(A);
  }
  long long centroid = dfs(1, -1);
  cout << dfs_dist(centroid, -1).first << endl;
  return 0;
}
