#include <bits/stdc++.h>
using namespace std;
int v, e, n, m, i, j, k, dis[1202][1202], g[1202][1202], pos[1202], match[1202];
bool vis[1202];
int read() {
  char c = getchar();
  int w = 0;
  while (c < '0' || c > '9') c = getchar();
  while (c <= '9' && c >= '0') {
    w = w * 10 + c - '0';
    c = getchar();
  }
  return w;
}
bool dfs(int x) {
  for (int y = 1; y <= v; y++) {
    if (g[x][y] && !vis[y]) {
      vis[y] = 1;
      if (!match[y] || dfs(match[y])) {
        match[y] = x;
        return 1;
      }
    }
  }
  return 0;
}
int hungary() {
  memset(match, 0, sizeof(match));
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    memset(vis, 0, sizeof(vis));
    if (dfs(i)) ans++;
  }
  return ans;
}
bool check(int x) {
  memset(g, 0, sizeof(g));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= v; j++) {
      if (dis[pos[i]][j] <= x) g[i][j] = 1;
    }
  }
  int ans = hungary();
  return (ans >= m);
}
int main() {
  v = read();
  e = read();
  n = read();
  m = read();
  for (i = 1; i <= n; i++) pos[i] = read();
  memset(dis, 0x3f, sizeof(dis));
  for (i = 1; i <= v; i++) dis[i][i] = 0;
  for (i = 1; i <= e; i++) {
    int u = read(), v = read(), w = read();
    dis[u][v] = dis[v][u] = min(dis[u][v], w);
  }
  for (k = 1; k <= v; k++) {
    for (i = 1; i <= v; i++) {
      for (j = 1; j <= v; j++)
        dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
    }
  }
  int l = 0, r = 1731311, mid, ans = -1;
  while (l <= r) {
    mid = (l + r) / 2;
    if (check(mid)) {
      ans = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  printf("%d\n", ans);
  return 0;
}
