#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int a[N];
vector<int> adj[N];
bool good[105], vis[N];
int main() {
  int n, m, k, s;
  scanf("%d%d%d%d", &n, &m, &k, &s);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    u--;
    v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 0; i < n; i++) {
    memset(good, 0, sizeof(good));
    memset(vis, 0, sizeof(vis));
    int target = s;
    queue<pair<int, int>> pos;
    pos.push(make_pair(i, 0));
    vis[i] = true;
    int cost = 0;
    while (target > 0) {
      int prv = pos.front().first;
      int step = pos.front().second;
      pos.pop();
      if (not good[a[prv]]) {
        target--;
        good[a[prv]] = true;
        cost += step;
      }
      for (int i = 0; i < adj[prv].size(); i++) {
        int nxt = adj[prv][i];
        if (not vis[nxt]) {
          pos.push(make_pair(nxt, step + 1));
          vis[nxt] = true;
        }
      }
    }
    printf("%d ", cost);
  }
  return 0;
}
