func_code_string: #include <bits/stdc++.h>   using namespace std;   long long int a[100001] = {0};   long long int d[100001] = {0};   long long int vis[100001] = {0};   long long int cons[100001] = {0};   vector<long long int> vec[100001];   void dfs(long long int x, long long int p) {     vis[x] = 1;     if (a[x] == 1) {       if (a[p] == 1) {         cons[x] = cons[p] + 1;       } else {         cons[x] = 1;       }       d[x] = max(d[p], cons[x]);     } else {       cons[x] = 0;       d[x] = d[p];     }     for (long long int i = 0; i < vec[x].size(); i++) {       if (vis[vec[x][i]] == 1)         continue;       else {         dfs(vec[x][i], x);       }     }   }   signed main() {     long long int n, m;     cin >> n >> m;     for (long long int i = 0; i < n; i++) cin >> a[i + 1];     for (long long int i = 0; i < n - 1; i++) {       long long int x, y;       cin >> x >> y;       vec[x].push_back(y);       vec[y].push_back(x);     }     dfs(1, 0);     long long int count = 0;     for (long long int i = 2; i <= n; i++) {       if (vec[i].size() == 1 && d[i] <= m) count++;     }     cout << count;   }   