#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#include <map>
#include <set>
using namespace std;
#define type(x) __typeof((x).begin())
#define foreach(i, x) for(type(x) i = (x).begin(); i != (x).end(); i++)
typedef long long ll;
typedef pair < int , int > ii;
const int inf = 1e9 + 333 ;
const ll linf = 1e18 + 333 ;
const int N = 5e4 + 5 ;
int n, m, t, k;
int dist[ N] , q[ N * 100 ] ;
bool h[ N] ;
vector < ii > v[ N] ;
int main ( ) {
scanf ( "%d %d %d %d" , & n, & m, & t, & k) ;
for ( int i = 1 ; i <= n; i++ )
dist[ i] = inf;
for ( int i = 1 ; i <= m; i++ ) {
int x, y, c;
scanf ( "%d %d %d" , & x, & y, & c) ;
v[ x] .push_back ( { y, c} ) ;
v[ y] .push_back ( { x, c} ) ;
}
int ans = n;
for ( int i = 1 ; i <= t; i++ ) {
int x;
scanf ( "%d" , & x) ;
if ( dist[ x] ) {
dist[ x] = 0 ;
int sz = 0 ;
q[ sz++ ] = x;
for ( int i = 0 ; i < sz; i++ ) {
int x = q[ i] ;
ans - = ! h[ x] ;
h[ x] = 1 ;
foreach( it, v[ x] ) {
int u = it - > first;
int e = it - > second;
if ( dist[ x] + e < k and dist[ x] + e < dist[ u] ) {
dist[ u] = dist[ x] + e;
q[ sz++ ] = u;
}
}
}
}
printf ( "%d\n " , ans) ;
}
return 0 ;
}
I2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y2Fzc2VydD4KI2luY2x1ZGUgPGNzdGRsaWI+CiNpbmNsdWRlIDxjc3RyaW5nPgojaW5jbHVkZSA8Y3N0ZGlvPgojaW5jbHVkZSA8Y21hdGg+CiNpbmNsdWRlIDxxdWV1ZT4KI2luY2x1ZGUgPG1hcD4KI2luY2x1ZGUgPHNldD4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgojZGVmaW5lIHR5cGUoeCkgX190eXBlb2YoKHgpLmJlZ2luKCkpCiNkZWZpbmUgZm9yZWFjaChpLCB4KSBmb3IodHlwZSh4KSBpID0gKHgpLmJlZ2luKCk7IGkgIT0gKHgpLmVuZCgpOyBpKyspCgp0eXBlZGVmIGxvbmcgbG9uZyBsbDsKdHlwZWRlZiBwYWlyIDwgaW50LCBpbnQgPiBpaTsKCmNvbnN0IGludCBpbmYgPSAxZTkgKyAzMzM7CmNvbnN0IGxsIGxpbmYgPSAxZTE4ICsgMzMzOwoKY29uc3QgaW50IE4gPSA1ZTQgKyA1OwoKaW50IG4sIG0sIHQsIGs7CmludCBkaXN0W05dLCBxW04gKiAxMDBdOwpib29sIGhbTl07CnZlY3RvciA8IGlpID4gdltOXTsKCmludCBtYWluICgpIHsKICAgIAogICAgc2NhbmYoIiVkICVkICVkICVkIiwgJm4sICZtLCAmdCwgJmspOwogICAgCiAgICBmb3IoaW50IGkgPSAxOyBpIDw9IG47IGkrKykKICAgICAgICBkaXN0W2ldID0gaW5mOwogICAgCiAgICBmb3IoaW50IGkgPSAxOyBpIDw9IG07IGkrKykgewogICAgICAgIGludCB4LCB5LCBjOwogICAgICAgIHNjYW5mKCIlZCAlZCAlZCIsICZ4LCAmeSwgJmMpOwogICAgICAgIHZbeF0ucHVzaF9iYWNrKHt5LCBjfSk7CiAgICAgICAgdlt5XS5wdXNoX2JhY2soe3gsIGN9KTsKICAgIH0KICAgIAogICAgaW50IGFucyA9IG47CiAgICAKICAgIGZvcihpbnQgaSA9IDE7IGkgPD0gdDsgaSsrKSB7CiAgICAgICAgaW50IHg7CiAgICAgICAgc2NhbmYoIiVkIiwgJngpOwogICAgICAgIGlmKGRpc3RbeF0pIHsKICAgICAgICAgICAgZGlzdFt4XSA9IDA7CiAgICAgICAgICAgIGludCBzeiA9IDA7CiAgICAgICAgICAgIHFbc3orK10gPSB4OwogICAgICAgICAgICBmb3IoaW50IGkgPSAwOyBpIDwgc3o7IGkrKykgewogICAgICAgICAgICAgICAgaW50IHggPSBxW2ldOwogICAgICAgICAgICAgICAgYW5zIC09ICFoW3hdOwogICAgICAgICAgICAgICAgaFt4XSA9IDE7CiAgICAgICAgICAgICAgICBmb3JlYWNoKGl0LCB2W3hdKSB7CiAgICAgICAgICAgICAgICAgICAgaW50IHUgPSBpdCAtPiBmaXJzdDsKICAgICAgICAgICAgICAgICAgICBpbnQgZSA9IGl0IC0+IHNlY29uZDsKICAgICAgICAgICAgICAgICAgICBpZihkaXN0W3hdICsgZSA8IGsgYW5kIGRpc3RbeF0gKyBlIDwgZGlzdFt1XSkgewogICAgICAgICAgICAgICAgICAgICAgICBkaXN0W3VdID0gZGlzdFt4XSArIGU7CiAgICAgICAgICAgICAgICAgICAgICAgIHFbc3orK10gPSB1OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBwcmludGYoIiVkXG4iLCBhbnMpOwogICAgfQogICAgCiAgICByZXR1cm4gMDsKICAgIAp9