#include <bits/stdc++.h>
using namespace std;
struct _Edge {
  int from, to, dis, next;
} _edge[400010 << 1];
struct Edge {
  int from, to, cap, flow, next;
} edge[400010 << 1];
int _tot, tot = 1, _head[2010], head[2010];
int n, m, v, k, p;
int d[610][610];
int st[2010];
inline void _addedge(int u, int v, int w) {
  _edge[++_tot] = (_Edge){u, v, w, _head[u]};
  _head[u] = _tot;
  _edge[++_tot] = (_Edge){v, u, w, _head[v]};
  _head[v] = _tot;
}
inline void addedge(int u, int v, int cap) {
  edge[++tot] = (Edge){u, v, cap, 0, head[u]};
  head[u] = tot;
  edge[++tot] = (Edge){v, u, 0, 0, head[v]};
  head[v] = tot;
}
priority_queue<pair<int, int>, vector<pair<int, int> >,
               greater<pair<int, int> > >
    q;
queue<int> Q;
int dis[2010];
inline void dijkstra(int s) {
  memset(dis, 0x3f, sizeof(dis));
  dis[s] = 0;
  q.push(make_pair(dis[s], s));
  while (!q.empty()) {
    pair<int, int> now = q.top();
    q.pop();
    if (dis[now.second] < now.first) continue;
    for (int i = _head[now.second]; i; i = _edge[i].next) {
      _Edge e = _edge[i];
      if (dis[e.to] > dis[now.second] + e.dis) {
        dis[e.to] = dis[now.second] + e.dis;
        q.push(make_pair(dis[e.to], e.to));
      }
    }
  }
}
bool vis[2010];
int cur[2010];
inline bool bfs(int S, int T) {
  memset(vis, 0, sizeof(vis));
  memset(dis, 0x3f, sizeof(dis));
  Q.push(S);
  vis[S] = true;
  dis[S] = 0;
  while (!Q.empty()) {
    int now = Q.front();
    Q.pop();
    for (int i = head[now]; i; i = edge[i].next) {
      Edge e = edge[i];
      if (e.cap > e.flow && !vis[e.to]) {
        dis[e.to] = dis[now] + 1;
        vis[e.to] = true;
        Q.push(e.to);
      }
    }
  }
  return vis[T];
}
inline int dfs(int now, int a, int T) {
  if (now == T or a == 0) {
    return a;
  }
  int flow = 0;
  for (int &i = cur[now]; i; i = edge[i].next) {
    Edge &e = edge[i];
    if (dis[e.to] != dis[now] + 1) continue;
    int f = dfs(e.to, min(a, e.cap - e.flow), T);
    if (f) {
      flow += f;
      e.flow += f;
      edge[i ^ 1].flow -= f;
      a -= f;
      if (!a) break;
    }
  }
  return flow;
}
inline int dinic(int S, int T) {
  int flow = 0;
  while (bfs(S, T)) {
    for (int i = S; i <= T; i++) {
      cur[i] = head[i];
    }
    flow += dfs(S, 0x3f3f3f3f, T);
  }
  return flow;
}
inline bool judge(int x) {
  tot = 1;
  memset(head, 0, sizeof(head));
  int S = 0, T = n + v + 1;
  for (int i = 1; i <= v; i++) {
    for (int j = 1; j <= n; j++) {
      if (d[st[i]][j] <= x) {
        addedge(i, v + j, 1);
      }
    }
  }
  for (int i = 1; i <= v; i++) {
    addedge(S, i, 1);
  }
  for (int i = 1; i <= n; i++) {
    addedge(v + i, T, 1);
  }
  if (dinic(S, T) >= k) {
    return true;
  }
  return false;
}
bool used[2010];
int main() {
  scanf("%d%d%d%d", &n, &m, &v, &k);
  for (int i = 1; i <= v; i++) {
    scanf("%d", &st[i]);
  }
  for (int i = 1; i <= m; i++) {
    int u, v, w;
    scanf("%d%d%d", &u, &v, &w);
    _addedge(u, v, w);
  }
  for (int i = 1; i <= v; i++) {
    if (used[st[i]]) continue;
    dijkstra(st[i]);
    for (int j = 1; j <= n; j++) {
      d[st[i]][j] = dis[j];
    }
  }
  int L = 0, R = 1731311, ans = 0x3f3f3f3f;
  while (L <= R) {
    int mid = (L + R) >> 1;
    if (judge(mid)) {
      ans = mid;
      R = mid - 1;
    } else {
      L = mid + 1;
    }
  }
  if (ans == 0x3f3f3f3f)
    puts("-1");
  else
    printf("%d\n", ans);
  return 0;
}
