Given $1\leq k\leq m$, $2\leq d\leq c i\ln i$ and $2\leq i\leq c'\ln(mi\ln i)$ at some $c,c'>0$ how many sequences (lower and upper bounds) are of form $$z_1,\dots,z_m$$ on the condition that
$$0\leq z_1\leq\dots\leq z_m\leq 2^d$$ $$|\{i\in\{1,\dots,m\}: z_i\neq z_{i+1}\}|=k$$
are there?
Is there a standard combinatorics problem associated with such problems?
References would be very helpful.