#include <bits/stdc++.h>
using namespace std;
long long res, s;
int T, n, k, t, po, ki, c[200002];
vector<vector<int> > e(200002);
long long dfs(int nom, int pre) {
  long long ans = c[nom], t;
  for (int i = 0; i < e[nom].size(); ++i)
    if (e[nom][i] != pre) {
      t = dfs(e[nom][i], nom);
      res += min(t, s - t);
      ans += t;
    }
  return ans;
}
int main() {
  cin >> n >> k;
  s = 2 * k;
  for (int i = 1; i <= 2 * k; ++i) {
    cin >> t;
    c[t] = 1;
  }
  for (int i = 1; i < n; ++i) {
    cin >> po >> ki;
    e[po].push_back(ki);
    e[ki].push_back(po);
  }
  dfs(1, 0);
  cout << res << "\n";
}
