#include <bits/stdc++.h>

using namespace std;

#define MS(a, b) memset(a, b, sizeof(a))
#define REP(a, b, c) for (register int a = b, _n = c; a <= _n; ++a)
#define DREP(a, b, c) for (register int a = b, _n = c; a >= _n; --a)
#define FOR(a, b, c) for (register int a = b, _n = c; a < _n; ++a)
#define EREP(a, b) for (register int a = head[b]; a; a = edge[a].nxt)

inline int rd () {
    int x = 0; char c = getchar(); bool f = 0;
    while (c < '0' && c != '-') c = getchar();
    if (c == '-') f = 1, c = getchar();
    while (c >= '0') x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
    return f ? -x : x;
}

const int SIZE = 2e5 + 100;

int n, K;

int head[SIZE], ecnt;
struct Edge {
    int v, nxt;
} edge[SIZE << 1];
void Add_Edge (int u, int v) {
    edge[++ecnt] = (Edge) { v, head[u] };
    head[u] = ecnt;
}

int bz[SIZE][18], dep[SIZE];
void dfs (int u, int fa) {
    bz[u][0] = fa;
    dep[u] = dep[fa] + 1;
    EREP (i, u) {
        int v = edge[i].v;
        if (v == fa) continue;
        dfs(v, u);
    }
}

int a[SIZE];
struct cmp {
    bool operator () (const int& x1, const int& x2) const {
        return dep[x1] > dep[x2];
    }
};

int dis[SIZE], mid;
void Cover (int u) {
    if (dis[u] == mid) return;
    EREP (i, u) {
        int v = edge[i].v;
        if (dis[v] == -1 || dis[v] > dis[u] + 1) {
            dis[v] = dis[u] + 1;
            Cover(v);
        }
    }
}

void _main () {
    n = rd(), K = rd();
    FOR (i, 1, n) {
        int u = rd(), v = rd();
        Add_Edge(u, v);
        Add_Edge(v, u);
    }
    dfs(1, 0);
    REP (i, 1, n) a[i] = i;
    sort(a + 1, a + n + 1, cmp());

    REP (i, 1, 17) REP (j, 1, n)
        bz[j][i] = bz[bz[j][i - 1]][i - 1];

    int L = 1, R = n, res = n;
    while (L <= R) {
        mid = (L + R) >> 1;
        int num = 0;
        MS(dis, -1);
        REP (i, 1, n) {
            int u = a[i];
            if (dis[u] == -1) {
                ++num;
                DREP (j, 17, 0) if (1 << j & mid)
                    u = bz[u][j];
                if (u == 0) u = 1;
                dis[u] = 0;
                Cover(u);
            }
        }
        if (num <= K) res = mid, R = mid - 1;
        else L = mid + 1;
    }
    cout << res << endl;
}

int main () {
    _main();
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=(n)-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<unordered_setprecision(x)
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,1,0,-1,1,-1,1,-1};
template <typename T> inline bool chmax(T &a, T b) {
  return ((a < b) ? (a = b, true) : (false));
}
template <typename T> inline bool chmin(T &a, T b) {
  return ((a > b) ? (a = b, true) : (false));
}

int main(){
  ll k,n,m;cin >> k >> n >>m;
  vl a(k);rep(i,k)cin >> a[i];
  ll sum=0;
  vl b(k);rep(i,k){
    b[i]=(m*a[i]+n-1)/n;
    sum+=b[i];
  }
  //rep(i,k)cout << b[i] <<" ";cout << endl;
  vpl st(k);
  rep(i,k){
    st[i]={b[i]*n-a[i]*m,i};
  }
  sort(all(st));rev(all(st));
  //cout << sum-m <<endl;
  rep(i,sum-m){
    b[st[i].se]--;
  }
  rep(i,k)cout << b[i] <<" ";cout << endl;
} 
