#include <bits/stdc++.h>
using namespace std;
template <class T>
using min_queue = priority_queue<T, vector<T>, greater<T>>;
template <typename Args>
void kill(Args args) {
  cout << args << "\n";
  exit(0);
}
const double PI = acos(-1);
const long long MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LLINF = 0x3f3f3f3f3f3f3f3f;
const int N = 101010;
vector<int> adj[N];
int types[N];
vector<int> dd[150];
int n, m, s, k;
set<int> st;
vector<int> mins[N];
void solve(int testnum) {
  cin >> n >> m >> k >> s;
  for (int i = 1; i <= n; i++) {
    cin >> types[i];
    dd[types[i]].emplace_back(i);
    st.insert(types[i]);
  }
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].emplace_back(v);
    adj[v].emplace_back(u);
  }
  for (int t : st) {
    queue<int> q;
    int dist[N];
    memset(dist, INF, sizeof dist);
    for (int s : dd[t]) {
      q.push(s);
      dist[s] = 0;
    }
    while (q.size()) {
      int node = q.front();
      q.pop();
      for (int next : adj[node]) {
        if (dist[next] > dist[node] + 1) {
          dist[next] = dist[node] + 1;
          q.push(next);
        }
      }
    }
    for (int i = 1; i <= n; i++) {
      mins[i].emplace_back(dist[i]);
    }
  }
  for (int i = 1; i <= n; i++) {
    sort((mins[i]).begin(), (mins[i]).end());
    long long sum = 0;
    for (int j = 0; j < s; j++) {
      sum += mins[i][j];
    }
    cout << sum << " \n"[i == n];
  }
}
void precompute() {}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(12);
  int testcase = 1;
  clock_t zzzx = clock();
  precompute();
  for (int i = 1; i <= testcase; i++) {
    solve(i);
  }
  double elapsed_time = (double)(clock() - zzzx) / CLOCKS_PER_SEC;
  cerr << "elapsed_time"
       << " = " << (elapsed_time) << "\n";
  return 0;
}
