#include<bits/stdc++.h>
using namespace std;
#define I inline
#define W while
#define gc getchar
const int N = 100010, M = N * 2; int h[N], to[M], nxt[M], idx, n, k, dp[N][20], dep[N], ans[N], mx;
I void add(int a, int b) {to[idx] = b; nxt[idx] = h[a]; h[a] = idx++;}
I void Read(int &x) {
x = 0; char ch = gc(); W(ch < '0' || ch > '9') ch = gc();
W(ch >= '0' && ch <= '9') x = x * 10 + (ch ^ 48), ch = gc();
}
I void Read(int &x, int &y) {Read(x), Read(y);}
I void dfs(int u, int fa) {
dp[u][0] = fa; dep[u] = dep[fa] + 1;
for(int i = h[u]; i != -1; i = nxt[i]) {int v = to[i]; if(v == fa) continue; dfs(v, u); }
}
I void RMQ() {for(int i = 1; i < 20; i++) for(int j = 1; j <= n; j++) dp[j][i] = dp[dp[j][i - 1]][i - 1];}
I int LCA(int x, int y) {
if(dep[x] < dep[y]) swap(x, y); int delta = dep[x] - dep[y];
for(int i = 19; i >= 0; i--) if(delta & (1 << i)) x = dp[x][i]; if(x == y) return x;
for(int i = 19; i >= 0; i--) if(dp[x][i] != dp[y][i]) x = dp[x][i], y = dp[y][i]; return dp[x][0];
}
I void update(int u, int fa) {
for(int i = h[u]; i != -1; i = nxt[i]) {
int v = to[i]; if(v == fa) continue; update(v, u); ans[u] += ans[v]; }
}
int main() {
memset(h, -1, sizeof h); Read(n, k); int a, b, x, y;
for(int i = 1; i < n; i++) {Read(a, b); add(a, b);} dfs(1, 0); RMQ();
W(k--) {Read(x, y); int l = LCA(x, y); ans[x]++, ans[y]++; ans[dp[l][0]]--, ans[l]--;}
update(1, 0); for(int i = 1; i <= n; i++) mx = max(mx, ans[i]); cout << mx;
return 0;
}