  The gravitational wave event from the binary neutron star (BNS) merger
GW170817 and the following multi-messenger observations present strong evidence
for i) merger ejecta expanding with substantial velocities and ii) a
relativistic jet which had to propagate through the merger ejecta. The ejecta's
expansion velocity is not negligible for the jet head motion, which is a
fundamental difference from the other systems like collapsars and active
galactic nuclei. Here we present an analytic model of the jet propagation in an
expanding medium. In particular, we notice a new term in the expression of the
breakout time and velocity. In parallel, we perform a series of over a hundred
2D numerical simulations of jet propagation. The BNS merger ejecta is prepared
based on numerical relativity simulations of a BNS merger with the
highest-resolution to date. We show that our analytic results agree with
numerical simulations over a wide parameter space. Then we apply our analytic
model to GW170817, and obtain two solid constraints on: i) the central engine
luminosity as $L_{iso,0} \sim 3\times10^{49}-2.5\times10^{52}$ erg s$^{-1}$,
and on ii) the delay time between the merger and engine activation $t_0-t_m <
1.3$ s. The engine power implies that the apparently-faint \textit{short}
gamma-ray burst (\textit{s}GRB) \textit{s}GRB 170817A is similar to typical
\textit{s}GRBs if observed on-axis.
