#include <bits/stdc++.h>
using namespace std;
int n, m, k, s, a[100005];
vector<vector<int>> g;
int d[100005][101];
int main() {
  scanf("%i%i%i%i", &n, &m, &k, &s);
  g.resize(n);
  for (int i = 0; i < n; ++i) {
    scanf("%i", &a[i]);
  }
  for (int i = 0; i < m; ++i) {
    int x, y;
    scanf("%i%i", &x, &y);
    g[--x].push_back(--y);
    g[y].push_back(x);
  }
  for (int i = 1; i <= k; ++i) {
    queue<int> q;
    bool vis[100005] = {0};
    for (int j = 0; j < n; ++j) {
      if (a[j] == i) {
        q.push(j);
        vis[j] = 1;
      }
    }
    while (!q.empty()) {
      int v = q.front();
      q.pop();
      vis[v] = 1;
      for (int j = 0; j < g[v].size(); ++j) {
        if (vis[g[v][j]]) continue;
        d[g[v][j]][i] = d[v][i] + 1;
        q.push(g[v][j]);
        vis[g[v][j]] = 1;
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    sort(d[i], d[i] + k + 1);
    long long sum = 0;
    for (int j = 2; j <= s; j++) {
      sum += d[i][j];
    }
    cout << sum << " ";
  }
  return 0;
}
