#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > G;
vector<vector<int> > col;
int dfs_num[100001];
int ans[100001][101];
int n;
void bfs(int u) {
  queue<int> q;
  for (int i = 1; i <= n; i++) ans[i][u] = 1000000;
  for (int i = 0; i < col[u].size(); i++) {
    int v = col[u][i];
    q.push(v);
    ans[v][u] = 0;
  }
  while (q.size()) {
    int v = q.front();
    q.pop();
    for (int i = 0; i < G[v].size(); i++) {
      int to = G[v][i];
      if (ans[to][u] > ans[v][u] + 1) {
        ans[to][u] = ans[v][u] + 1;
        q.push(to);
      }
    }
  }
}
int main() {
  int m, u, v, s, k;
  cin >> n >> m >> k >> s;
  G.assign(n + 1, vector<int>());
  col.assign(k + 1, vector<int>());
  for (int i = 1; i <= n; i++) {
    cin >> u;
    col[u].push_back(i);
  }
  while (m--) {
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  for (int i = 1; i <= k; i++) bfs(i);
  for (int i = 1; i <= n; i++) {
    int sum = 0;
    sort(ans[i] + 1, ans[i] + k + 1);
    for (int j = 1; j <= s; j++) sum += ans[i][j];
    cout << sum << " ";
  }
}
