#include <bits/stdc++.h>
using namespace std;
int n, m, k, s;
int dis[100005][105];
int vis[100005];
int town[10005];
vector<int> vec[105];
vector<int> vec2[100005];
struct node {
  int x, d;
};
void bfs(int a) {
  queue<node> que;
  for (int i = 0; i < vec[a].size(); i++) {
    int temp = vec[a][i];
    node q;
    q.x = temp, q.d = 0;
    que.push(q);
  }
  while (!que.empty()) {
    node u = que.front();
    que.pop();
    dis[u.x][a] = min(u.d, dis[u.x][a]);
    for (int i = 0; i < vec2[u.x].size(); i++) {
      int temp1 = vec2[u.x][i];
      if (vis[temp1]) continue;
      vis[temp1] = 1;
      node q;
      q.x = temp1;
      q.d = u.d + 1;
      que.push(q);
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  scanf("%d%d", &k, &s);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &town[i]);
    vec[town[i]].push_back(i);
  }
  for (int i = 1; i <= m; i++) {
    int temp1, temp2;
    scanf("%d%d", &temp1, &temp2);
    vec2[temp1].push_back(temp2);
    vec2[temp2].push_back(temp1);
  }
  memset(dis, 0x3f3f3f3f, sizeof(dis));
  for (int i = 1; i <= k; i++) {
    memset(vis, 0, sizeof(vis));
    bfs(i);
  }
  for (int i = 1; i <= n; i++) {
    sort(dis[i] + 1, dis[i] + k + 1);
    long long sum = 0;
    for (int j = 1; j <= s; j++) {
      sum += dis[i][j];
    }
    cout << sum << ' ';
  }
  return 0;
}
