#include <bits/stdc++.h>
using namespace std;
int n, m, k, s;
int arr[100005][105];
vector<int> adj[100005];
int vis[100005];
vector<int> v[110];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k >> s;
  int i, j;
  for (i = 0; i < 100005; i++) {
    for (j = 0; j < 105; j++) arr[i][j] = 1e9;
  }
  for (i = 1; i <= n; i++) {
    int x;
    cin >> x;
    arr[i][x] = 0;
    v[x].push_back(i);
  }
  for (i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  fill(vis, vis + 100005, 0);
  for (i = 1; i <= k; i++) {
    queue<int> q;
    for (j = 0; j < v[i].size(); j++) {
      q.push(v[i][j]);
      vis[v[i][j]] = 1;
    }
    while (!q.empty()) {
      int temp = q.front();
      q.pop();
      for (j = 0; j < adj[temp].size(); j++) {
        int x = adj[temp][j];
        if (arr[x][i] > arr[temp][i] + 1) {
          q.push(x);
          vis[x] = 1;
          arr[x][i] = arr[temp][i] + 1;
        }
      }
    }
  }
  for (i = 1; i <= n; i++) {
    sort(arr[i] + 1, arr[i] + k + 1);
    int sum = 0;
    for (j = 1; j <= s; j++) sum += arr[i][j];
    cout << sum << " ";
  }
  cout << "\n";
  return 0;
}
