#include <bits/stdc++.h>
using namespace std;
int n, m, k, s, q[111111], vis[111111], w[111111], d[111][111111];
vector<int> g[111], e[111111];
void bfs(int a) {
  int ft = 0, lt = 0;
  for (int i = 1; i <= n; i++) {
    vis[i] = 0;
    d[a][i] = 1e9;
  }
  for (int i = 0; i < g[a].size(); i++) {
    q[++lt] = g[a][i];
    vis[g[a][i]] = 1;
    d[a][g[a][i]] = 0;
  }
  while (ft < lt) {
    int x = q[++ft];
    for (int i = 0; i < e[x].size(); i++) {
      if (!vis[e[x][i]]) {
        vis[e[x][i]] = 1;
        q[++lt] = e[x][i];
        d[a][e[x][i]] = d[a][x] + 1;
      }
    }
  }
}
int main() {
  cin >> n >> m >> k >> s;
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
    g[w[i]].push_back(i);
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    e[a].push_back(b);
    e[b].push_back(a);
  }
  for (int i = 1; i <= k; i++) {
    bfs(i);
  }
  for (int i = 1; i <= n; i++) {
    vector<int> t;
    for (int j = 1; j <= k; j++) {
      t.push_back(d[j][i]);
    }
    sort(t.begin(), t.end());
    long long ans = 0;
    for (int i = 0; i < s; i++) {
      ans += t[i];
    }
    cout << ans << ' ';
  }
  return 0;
}
