import static java.lang.Math.*;
import java.io.*;
import java.util.*;

public class invasion {

	void solve() throws Exception {
		
		int n = nextInt(), m = nextInt(), a = nextInt(), k = nextInt();
		while (n!=0) {
			
			LinkedList<Pos>[] graf = new LinkedList[n+1];
			for (int i=0; i<=n; ++i) graf[i] = new LinkedList<Pos>();
			HashSet<Integer> zle = new HashSet<>();
			
			for (int i=0; i<m; ++i) {
				int x = nextInt(), y = nextInt(), dist = nextInt();
				graf[x].add(new Pos(dist, y));
				graf[y].add(new Pos(dist, x));
			}
			
//			debug("GRAF: ",graf);
			
			for (int i=0; i<a; ++i) {
				int z = nextInt();
				zle.add(z);
				HashSet<Integer> tmp = ujo_dijkstra(graf, z, k);
				for (Integer t: tmp) zle.add(t);
				debug("TMP: ",tmp);
				debug("ZLE: ",zle);
				println(n-zle.size());
			}
			
			println();
			
			n = nextInt(); m = nextInt(); a = nextInt(); k = nextInt();
		}
		
	}
	
	class Pos implements Comparable<Pos> {
		int dist; int sus;
		public Pos(int d, int s) {
			dist=d; sus=s;
		}
		public int compareTo(Pos o) {
			if (dist==o.dist) return sus-o.sus;
			return dist-o.dist;
		}
		public String toString() {
			return dist+" "+sus;
		}
		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + getOuterType().hashCode();
			result = prime * result + dist;
			result = prime * result + sus;
			return result;
		}
		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			Pos other = (Pos) obj;
			if (!getOuterType().equals(other.getOuterType()))
				return false;
			if (dist != other.dist)
				return false;
			if (sus != other.sus)
				return false;
			return true;
		}
		private invasion getOuterType() {
			return invasion.this;
		}
		
	}
	
	HashSet<Integer> ujo_dijkstra(LinkedList<Pos>[] graf, int odkial, int k) {
		
		TreeSet<Pos> set = new TreeSet<Pos>();
		HashSet<Integer> zle = new HashSet<Integer>();
		int[] dist = new int[graf.length];
		Arrays.fill(dist, -1);
		dist[odkial] = 0;
		for (int i=0; i<graf.length; ++i) set.add(new Pos(i==odkial ? 0:Integer.MAX_VALUE, i));
		debug("VELKOST: ",set.size(),graf.length);
		
		while (!set.isEmpty()) {
			Pos act = set.first();
			set.remove(set.first());
			int actID = act.sus;
			int actDist = dist[actID];
			
			/*if (dist[ID]<k)*/ for (Pos sused: graf[actID]) {
				int susID = sused.sus;
				int susDist = sused.dist;
				debug(actID, susID);
				if (dist[susID]==-1 || actDist+susDist < dist[susID]) {
					debug("ZLEPSIL: ", actID, susID);
					dist[susID] = actDist+susDist;
					if (dist[susID]<k) zle.add(susID);
					set.remove(sused);
					set.add(new Pos(dist[susID],susID));
				}
			}
		}
		debug(dist);
		return zle;
		
	}
	
	
	
	////////////////////////////////////////////////////////////////

	BufferedInputStream bis = new BufferedInputStream(System.in);
	
	String nextWord() throws IOException {
		StringBuilder sb = new StringBuilder();
		int ch = bis.read();
		while (ch<=' ') ch=bis.read();
		while (ch>' ') {
			sb.append((char)ch);
			ch=bis.read();
		}
		return new String(sb);
	}
	String nextLine() throws IOException {
		StringBuilder sb = new StringBuilder();
		int ch = bis.read();
		while (ch<=' ') ch=bis.read();
		while (ch!='\n' && ch!='\r') {
			sb.append((char)ch);
			ch=bis.read();
		}
		return new String(sb);
	}
	int nextInt() throws NumberFormatException, IOException {
		return Integer.parseInt(nextWord());
	}
	long nextLong() throws NumberFormatException, IOException {
		return Long.parseLong(nextWord());
	}
	double nextDouble() throws NumberFormatException, IOException {
		return Double.parseDouble(nextWord());
	}
	
	void print(Object...o) {
		if (o==null) return;
		if (o.length==0) return;
		System.out.print(o[0]);
		for (int i=1; i<o.length; ++i) System.out.print(" "+o[i]);
	}
	void println(Object...o) {
		print(o);
		System.out.println();
	}
	
	String str(Object o) {
		return o.toString();
	}
	void debug(Object...o) {
		//System.err.println(Arrays.deepToString(o));
	}
	
	public static void main(String[] args) throws Exception {
		new invasion().solve();
	}

}
