#include <bits/stdc++.h>
using namespace std;
template <class T>
bool remin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool remax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int nxt() {
  int first;
  scanf("%d", &first);
  return first;
}
long long gcd(long long a, long long b) {
  a = abs(a);
  b = abs(b);
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
struct pt {
  long long first, second;
  pt() {}
  pt(long long first, long long second) : first(first), second(second) {}
  inline pt operator-(const pt &r) const {
    return pt(first - r.first, second - r.second);
  }
  inline pt operator+(const pt &r) const {
    return pt(first + r.first, second + r.second);
  }
  inline pt operator*(const long double &r) const {
    return pt(first * r, second * r);
  }
  inline long long sqlen() const {
    return abs(first * first + second * second);
  }
  inline bool operator<(const pt &r) const {
    if (first != r.first) return first < r.first;
    return second < r.second;
  }
  inline bool operator==(const pt &r) const {
    return first == r.first && second == r.second;
  }
};
ostream &operator<<(ostream &os, const pt &p) {
  return os << "(" << p.first << "," << p.second << ")";
}
inline long long cross(const pt &l, const pt &r) {
  return l.first * r.second - l.second * r.first;
}
inline long long dot(const pt &l, const pt &r) {
  return l.first * r.first + l.second * r.second;
}
long long pwmod(long long a, long long n, long long mod) {
  long long ret = 1;
  while (n) {
    if (n & 1) ret = ret * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return ret;
}
template <typename T>
inline T sqr(T first) {
  return first * first;
}
bool remin(long long &first, long long second) {
  if (first > second) {
    first = second;
    return 1;
  }
  return 0;
}
const int N = 200 * 1000 + 100;
vector<int> g[N];
char ok[N];
int cnt[N];
void dfs(int v, int p = -1) {
  cnt[v] = ok[v];
  for (int to : g[v]) {
    if (to == p) continue;
    dfs(to, v);
    cnt[v] += cnt[to];
  }
}
long long ans = 0;
void dfs2(int v, int p = -1, int cntp = 0) {
  for (int to : g[v]) {
    if (to == p) {
      ans += min(cnt[v], cntp);
      continue;
    }
    dfs2(to, v, cntp + cnt[v] - cnt[to]);
  }
}
void solve() {
  int n = nxt();
  int k = nxt();
  for (int i = 0; i < (int)(2 * k); i++) {
    int a = nxt() - 1;
    ok[a] = 1;
  }
  for (int i = 0; i < (int)(n - 1); i++) {
    int a = nxt() - 1;
    int b = nxt() - 1;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dfs(0);
  dfs2(0);
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
