#include <bits/stdc++.h>   using namespace std;   const int N = 805;   const int INF = 0x3f3f3f3f;   int n, m, k, lim;   struct Edge {     int from, to, flow, cap;     Edge(int f, int t, int fl, int c) : from(f), to(t), flow(fl), cap(c) {}   };   struct EK {     int n;     vector<Edge> E;     vector<int> g[N];     int p[N], df[N];     bool vis[N];     void init(int n) {       this->n = n;       for (int i = 1; i <= n; i++) g[i].clear();       E.clear();     }     void addEdge(int u, int v, int c) {       E.push_back(Edge(u, v, 0, c));       E.push_back(Edge(v, u, 0, 0));       int sz = E.size();       g[u].push_back(sz - 2);       g[v].push_back(sz - 1);     }     int bfs(int S, int T) {       memset(df, 0, sizeof(df));       memset(vis, 0, sizeof(vis));       queue<int> Q;       df[S] = 0x3f3f3f3f, vis[S] = 1;       Q.push(S);       while (!Q.empty()) {         int u = Q.front();         Q.pop();         for (int i = 0; i < ((int)g[u].size()); i++) {           Edge &e = E[g[u][i]];           if (!vis[e.to] && e.cap > e.flow) {             p[e.to] = g[u][i];             vis[e.to] = 1;             df[e.to] = min(df[e.from], e.cap - e.flow);             Q.push(e.to);           }         }         if (vis[T]) break;       }       for (int u = T; u != S; u = E[p[u]].from) {         E[p[u]].flow += df[T];         E[p[u] ^ 1].flow -= df[T];       }       return df[T];     }     int maxFlow(int S, int T) {       int F = 0;       while (1) {         int D = bfs(S, T);         if (!D) break;         F += D;       }       return F;     }   } T;   bool done[N];   vector<pair<int, int> > g[N];   int dis[N][N], st[N];   void dij(int s) {     memset(dis[s], 0x3f, sizeof(dis[s]));     memset(done, 0, sizeof(done));     priority_queue<pair<int, int>, vector<pair<int, int> >,                    greater<pair<int, int> > >         Q;     Q.push(make_pair(0, s));     dis[s][s] = 0;     while (!Q.empty()) {       int u = Q.top().second;       Q.pop();       if (done[u]) continue;       done[u] = 1;       for (int i = 0; i < ((int)g[u].size()); i++) {         int v = g[u][i].first, w = g[u][i].second;         if (dis[s][v] > dis[s][u] + w) {           dis[s][v] = dis[s][u] + w;           Q.push(make_pair(dis[s][v], v));         }       }     }   }   int tot;   bool check(int x) {     T.init(n + tot + 2);     int cur = 0;     for (int i = 1; i <= n; i++) {       if (st[i]) {         T.addEdge(n + tot + 1, ++cur, st[i]);         for (int j = 1; j <= n; j++)           if (dis[i][j] <= x) {             T.addEdge(cur, j + tot, 1);           }       }       T.addEdge(i + tot, n + tot + 2, 1);     }     return T.maxFlow(n + tot + 1, n + tot + 2) >= lim;   }   int main() {     scanf( %d%d%d%d , &n, &m, &k, &lim);     for (int i = 0; i < k; i++) {       int x;       scanf( %d , &x);       st[x]++;     }     for (int i = 1; i <= n; i++)       if (st[i]) tot++;     while (m--) {       int u, v, w;       scanf( %d%d%d , &u, &v, &w);       g[u].push_back(make_pair(v, w));       g[v].push_back(make_pair(u, w));     }     for (int i = 1; i <= n; i++) dij(i);     int l = 0, r = 1731312;     while (l + 1 < r) {       int mid = (l + r) / 2;       if (check(mid))         r = mid;       else         l = mid;     }     int ans = check(l) ? l : r;     printf( %d n , ans > 1731311 ? -1 : ans);     return 0;   }