#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1e5 + 10;
struct EDGE {
  int u, v, c;
} edge[MaxN];
int fa[MaxN];
vector<int> vec[MaxN];
int find(int u) {
  if (fa[u] == u) return u;
  return fa[u] = find(fa[u]);
}
bool cmp(EDGE a, EDGE b) { return a.c < b.c; }
int main() {
  int n, m, q;
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 1; i <= n; i++) fa[i] = i;
  for (int i = 1; i <= m; i++)
    scanf("%d %d %d", &edge[i].u, &edge[i].v, &edge[i].c);
  sort(edge + 1, edge + 1 + m, cmp);
  for (int i = 1; i <= m; i++) {
    int u = edge[i].u, v = edge[i].v;
    if (find(u) != find(v)) {
      fa[find(u)] = fa[find(v)];
      vec[u].push_back(v);
    }
  }
  int ans = 0;
  while (q--) {
    int w;
    scanf("%d", &w);
    for (int i = 1; i <= m; i++) {
      if (edge[i].c <= w) {
        ans++;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
