#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long power(long long x, unsigned long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
const long long inf = 1e18;
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
long long arr[100005];
long long level[100005];
vector<long long> adj[100005];
queue<long long> q;
long long ans[100005][105];
vector<long long> vec[105];
long long visited[100005];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m, k, s;
  cin >> n >> m >> k >> s;
  for (long long i = 1; i <= n; i++) {
    cin >> arr[i];
    vec[arr[i]].push_back(i);
  }
  for (long long i = 0; i < m; i++) {
    long long x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  for (long long i = 1; i <= k; i++) {
    for (long long j = 1; j <= n; j++) ans[j][i] = 1e18;
    for (long long j = 1; j <= n; j++) visited[j] = 0;
    for (long long j = 0; j < vec[i].size(); j++) {
      q.push(vec[i][j]);
      visited[vec[i][j]] = 1;
      ans[vec[i][j]][i] = 0;
    }
    while (!q.empty()) {
      long long node = q.front();
      q.pop();
      for (long long j = 0; j < adj[node].size(); j++) {
        if (visited[adj[node][j]] == 0) {
          q.push(adj[node][j]);
          ans[adj[node][j]][i] = ans[node][i] + 1;
          visited[adj[node][j]] = 1;
        }
      }
    }
    while (!q.empty()) q.pop();
  }
  for (long long i = 1; i <= n; i++) {
    long long val = 0;
    sort(ans[i] + 1, ans[i] + k + 1);
    for (long long j = 1; j <= s; j++) {
      val += ans[i][j];
    }
    cout << val << " ";
  }
  return 0;
}
