#include <bits/stdc++.h>
using namespace std;
int ar[] = {0, 0, 1, -1};
int ac[] = {1, -1, 0, 0};
int dist[100005][102], n, m, k, s;
int a[100005];
long long ans[100005];
vector<vector<int>> adj;
set<int> se[105];
void bfs(int i) {
  queue<int> qu;
  for (auto x : se[i]) qu.push(x);
  while (!qu.empty()) {
    int x = qu.front();
    qu.pop();
    for (auto nx : adj[x])
      if (dist[nx][i] > dist[x][i] + 1) {
        dist[nx][i] = dist[x][i] + 1;
        qu.push(nx);
      }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(6);
  cin >> n >> m >> k >> s;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) se[a[i]].insert(i);
  adj.assign(n + 5, vector<int>());
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= 100; j++) dist[i][j] = 1e9;
  for (int i = 1; i <= n; i++) dist[i][a[i]] = 0;
  for (int i = 1; i <= k; i++) bfs(i);
  for (int i = 1; i <= n; i++) {
    vector<int> ve;
    for (int j = 1; j <= k; j++) ve.push_back(dist[i][j]);
    sort(ve.begin(), ve.end());
    for (int j = 0; j < s; j++) ans[i] = ans[i] + ve[j];
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
  return 0;
}
