#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__)
#else
#define DEBUG(...) 6
#endif
template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template <typename T, typename... Args> void debug(string s, T x, Args... args) {for (int i=0, b=0; i<(int)s.size(); i++) if (s[i] == '(' || s[i] == '{') b++; else
if (s[i] == ')' || s[i] == '}') b--; else if (s[i] == ',' && b == 0) {cerr << s.substr(0, i) << " = " << x << " | "; debug(s.substr(s.find_first_not_of(' ', i + 1)), args...); break;}}
typedef tuple<int, int, int> node;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, m, a, k;
bool f = true;
while (cin >> n >> m >> a >> k, n || m || a || k) {
if (f) f = false;
else cout << "\n";
vector<vector<pair<int, int>>> adj(n);
for (int i=0; i<m; i++) {
int u, v, d;
cin >> u >> v >> d;
u--, v--;
adj[u].emplace_back(v, d);
adj[v].emplace_back(u, d);
}
vector<vector<int>> mn(n, vector<int>(k, a));
priority_queue<node, vector<node>, greater<node>> pq;
for (int i=0; i<a; i++) {
int b;
cin >> b;
b--;
if (mn[b][0] == a)
pq.emplace(mn[b][0] = i, b, 0);
}
while (!pq.empty()) {
auto [id, u, d] = pq.top();
pq.pop();
if (id > mn[u][d])
continue;
for (auto [v, w] : adj[u])
if (d + w < k && id < mn[v][d + w])
pq.emplace(mn[v][d + w] = id, v, d + w);
}
vector<int> rem(a + 1);
for (int u=0; u<n; u++)
rem[*min_element(mn[u].begin(), mn[u].end())]++;
int ret = n;
for (int i=0; i<a; i++) {
ret -= rem[i];
cout << ret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WU8bm9kZSwgdmVjdG9yPG5vZGU+LCBncmVhdGVyPG5vZGU+PiBwcTsKICAgICAgICBmb3IgKGludCBpPTA7IGk8YTsgaSsrKSB7CiAgICAgICAgICAgIGludCBiOwogICAgICAgICAgICBjaW4gPj4gYjsKICAgICAgICAgICAgYi0tOwogICAgICAgICAgICBpZiAobW5bYl1bMF0gPT0gYSkKICAgICAgICAgICAgICAgIHBxLmVtcGxhY2UobW5bYl1bMF0gPSBpLCBiLCAwKTsKICAgICAgICB9CiAgICAgICAgd2hpbGUgKCFwcS5lbXB0eSgpKSB7CiAgICAgICAgICAgIGF1dG8gW2lkLCB1LCBkXSA9IHBxLnRvcCgpOwogICAgICAgICAgICBwcS5wb3AoKTsKICAgICAgICAgICAgaWYgKGlkID4gbW5bdV1bZF0pCiAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgZm9yIChhdXRvIFt2LCB3XSA6IGFkalt1XSkKICAgICAgICAgICAgICAgIGlmIChkICsgdyA8IGsgJiYgaWQgPCBtblt2XVtkICsgd10pCiAgICAgICAgICAgICAgICAgICAgcHEuZW1wbGFjZShtblt2XVtkICsgd10gPSBpZCwgdiwgZCArIHcpOwogICAgICAgIH0KCiAgICAgICAgdmVjdG9yPGludD4gcmVtKGEgKyAxKTsKICAgICAgICBmb3IgKGludCB1PTA7IHU8bjsgdSsrKQogICAgICAgICAgICByZW1bKm1pbl9lbGVtZW50KG1uW3VdLmJlZ2luKCksIG1uW3VdLmVuZCgpKV0rKzsKCiAgICAgICAgaW50IHJldCA9IG47CiAgICAgICAgZm9yIChpbnQgaT0wOyBpPGE7IGkrKykgewogICAgICAgICAgICByZXQgLT0gcmVtW2ldOwogICAgICAgICAgICBjb3V0IDw8IHJldCA8PCAiXG4iOwogICAgICAgIH0KICAgIH0KCiAgICByZXR1cm4gMDsKfQo=