#include <bits/stdc++.h>
using namespace std;
vector<vector<long long> > sm(100100);
vector<long long> used(100100, 0);
vector<long long> len(100100, 0);
vector<long long> color(100100, 0);
vector<vector<long long> > col(200);
long long d[100100][200];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, m, s, k;
  cin >> n >> m >> k >> s;
  for (long long i = 1; i <= n; i++) {
    cin >> color[i];
    col[color[i]].push_back(i);
  }
  long long a, b;
  for (long long i = 1; i <= m; i++) {
    cin >> a >> b;
    sm[a].push_back(b);
    sm[b].push_back(a);
  }
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= k; j++) d[i][j] = 200200;
  long long top = 0, i1, i2, i3, j;
  for (i1 = 1; i1 <= k; i1++) {
    queue<long long> q;
    for (j = 1; j <= n; j++) {
      used[j] = 0;
      len[j] = 0;
    }
    for (j = 0; j < (long long)col[i1].size(); j++) {
      q.push(col[i1][j]);
      used[col[i1][j]] = 1;
      d[col[i1][j]][i1] = 0;
    }
    while (!q.empty()) {
      top = q.front();
      q.pop();
      for (j = 0; j < (long long)sm[top].size(); j++) {
        if (used[sm[top][j]] == 0) {
          q.push(sm[top][j]);
          used[sm[top][j]] = 1;
          len[sm[top][j]] = len[top] + 1;
          d[sm[top][j]][i1] = min(d[sm[top][j]][i1], len[top] + 1);
        }
      }
    }
  }
  vector<long long> temp(k);
  long long sum = 0;
  for (i1 = 1; i1 <= n; i1++) {
    for (j = 1; j <= k; j++) {
      temp[j - 1] = d[i1][j];
    }
    sort(temp.begin(), temp.end());
    sum = 0;
    for (i2 = 0; i2 < s; i2++) sum += temp[i2];
    cout << sum << " ";
  }
  return 0;
}
