#include #include #include #include using namespace std; int main() { int N,K,M,P,u,v,x; cin >> N >> K >> M >> P; vector> G(N); while(M--) { cin >> u >> v; G[u-1].push_back(v-1); G[v-1].push_back(u-1); } vector s(N); for(int i=0;i> s[i]; priority_queue>,vector>>,greater>>> q; while(K--) { cin >> x; q.push({0,{x-1,x-1}}); } int ans = 0; vector t(N,-1),t2(N,1ll<<60); while(!q.empty()) { pair> p = q.top(); q.pop(); if(p.first > t2[p.second.first])continue; if(t[p.second.second] < 0) { for(int i=0;i p.first && t2[p.second.second] == 1ll<<60) { ans++; t2[p.second.second] = p.first; } } cout << ans << endl; }