#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
using ll = long long int;
int main() {
int n, s;
cin >> n >> s;
s--;
vector<int> a(n), b(n);
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < n; i++) cin >> b[i];
vector<vector<int>> adj(n);
for (int i = 1; i < n; i++) {
int u, v;
cin >> u >> v;
u--; v--;
adj[u].push_back(v);
adj[v].push_back(u);
}
vector<ll> max_charge(n, -LLONG_MAX);
max_charge[s] = 1;
queue<int> q;
q.push(s);
vector<bool> visited(n, false);
visited[s] = true;
ll global_max = 1;
while (!q.empty()) {
int u = q.front();
q.pop();
for (int v : adj[u]) {
if (!visited[v]) {
visited[v] = true;
ll new_charge1 = max_charge[u] + a[v] - a[u];
ll new_charge2 = max_charge[u] + b[v] - b[u];
max_charge[v] = max({max_charge[v], new_charge1, new_charge2});
global_max = max(global_max, max_charge[v]);
q.push(v);
}
}
}
cout << global_max << endl;
}