#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 100;
int color[maxn];
const long long inf = 1e18;
int dist[101][maxn];
vector<int> ind[101];
vector<int> g[maxn];
queue<int> q;
bool visit[maxn];
void bfs(int col) {
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (auto v : g[u])
      if (dist[col][v] > (1 + dist[col][u])) {
        dist[col][v] = 1 + dist[col][u];
        q.push(v);
      }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, k, s;
  cin >> n >> m >> k >> s;
  for (int i = 1; i <= n; i++) cin >> color[i];
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    ind[color[i]].push_back(i);
  }
  for (int i = 0; i <= k; i++)
    for (int j = 0; j <= n; j++) dist[i][j] = 1e9;
  for (int i = 1; i <= k; i++) {
    for (auto v : ind[i]) {
      q.push(v);
      dist[i][v] = 0;
    }
    bfs(i);
  }
  for (int i = 1; i <= n; i++) {
    vector<int> cost;
    for (int j = 1; j <= k; j++) {
      cost.push_back(dist[j][i]);
    }
    sort(cost.begin(), cost.end());
    int total = 0;
    for (int i = 0; i < s; i++) total += cost[i];
    cout << total << " ";
  }
  return 0;
}
