#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<int, int> > > v;
vector<int> dis;
bool fl[1000010];
void dijkstra(int node) {
  priority_queue<pair<int, int>, vector<pair<int, int> >,
                 greater<pair<int, int> > >
      pq;
  dis[node] = 0;
  pq.push({0, node});
  while (!pq.empty()) {
    pair<int, int> pa = pq.top();
    int dd = pa.first;
    int from = pa.second;
    if (dd > dis[from]) {
      pq.pop();
      continue;
    }
    for (int i = 0; i < v[from].size(); i++) {
      pair<int, int> pap = v[from][i];
      if (dis[pap.first] > dis[from] + pap.second) {
        dis[pap.first] = dis[from] + pap.second;
        pq.push({dis[from] + pap.second, pap.first});
      }
    }
    pq.pop();
  }
}
int main() {
  int k, m, n, p, q, r, x;
  cin >> n >> m >> k;
  v.resize(n + 1);
  for (int i = 1; i <= m; i++) {
    cin >> p >> q >> r;
    v[p].push_back({q, r});
    v[q].push_back({p, r});
  }
  int source = 0;
  for (int i = 0; i < k; i++) {
    cin >> x;
    v[source].push_back({x, 1});
    fl[x] = true;
  }
  if (k == 0 || k == n) {
    cout << -1;
  } else {
    for (int i = 0; i <= n + 1; i++) {
      dis.push_back(1000000007);
    }
    dijkstra(source);
    int ans = 1000000007 + 1;
    for (int i = 1; i <= n; i++) {
      if (!fl[i]) {
        ans = min(ans, dis[i]);
      }
    }
    if (ans >= 1000000007)
      cout << -1;
    else
      cout << ans - 1;
  }
  return 0;
}
