func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, mid, rt, res, a[200010], f[200010], sz[200010];   vector<int> e[200010];   void dfs(int u, int fa) {     f[u] = sz[u] = 1;     int m1 = 0, m2 = 0;     for (auto v : e[u]) {       if (v == fa) continue;       dfs(v, u);       sz[u] += sz[v];       if (f[v] == sz[v])         f[u] += f[v];       else {         if (f[v] > m1) swap(f[v], m1);         if (f[v] > m2) swap(f[v], m2);       }     }     f[u] = a[u] < mid ? 0 : f[u] + m1;     res = max(res, f[u] + m2);   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     for (int i = 1; i < n; i++) {       int u, v;       scanf( %d%d , &u, &v);       e[u].push_back(v);       e[v].push_back(u);     }     rt = min_element(a + 1, a + 1 + n) - a;     int l = 0, r = 1000010, ans;     while (l <= r) {       mid = (l + r) >> 1;       res = 0;       dfs(rt, 0);       if (res >= m)         l = mid + 1, ans = mid;       else         r = mid - 1;     }     printf( %d n , ans);     return 0;   }   