# Constraint on bayesian likelihood expression

I'm doing MCMC simulation but I'm confused in some part of my model. I dont know which of my likelihood expression is right.

My model is as following.

$\gamma$ = $(\gamma_{1},\cdots,\gamma_{K})$ and $\gamma_{K}$ is depend on $\gamma_{1:(K-1)}$, which is $$\gamma_{K} = \left\{ \begin{array}{lr} 0, & \sum_{k=1}^{K-1}\gamma_{k} = 0 \\ 1, & \sum_{k=1}^{K-1}\gamma_{k} = 1.\\ bernoulli(\theta_{K}), &\sum_{k=1}^{K-1}\gamma_{k} >1 \end{array} \right.$$. Ang for $k = 1, \cdots, K-1$. $\gamma_{k} \sim bernoulli(\theta_{k})$.

Now I have prior on $\theta_{1:K}$, which denotes by $p(\theta_{1},\cdots,\theta_{K})$.

So my likelihood should be

$likili = p(\gamma \mid \theta)*p(\theta)$

But I'm confused that which of the following form is right?

(1) $likeli = \big[\delta_{0}(\gamma_{K})^{\mathbf{1}[{\sum_{k=1}^{K-1}\gamma_{k}=0}]} \delta_{1}(\gamma_{K})^{\mathbf{1}[{\sum_{k=1}^{K-1}\gamma_{k}=1}]} ber(\theta_{K})^{\mathbf{1}[{\sum_{k=1}^{K-1}\gamma_{k}>1}]} \prod_{k=1}^{K-1}ber(\theta_{k}) \big]* \prod_{k=1}^{K}p(\theta_{k})$

(2) $likeli = \big[\delta_{0}(\gamma_{K})^{\mathbf{1}[{\sum_{k=1}^{K-1}\gamma_{k}=1}]} \delta_{1}(\gamma_{K})^{\mathbf{1}[{\sum_{k=1}^{K-1}\gamma_{k}=1}]} ber(\theta_{K})^{\mathbf{1}[{\sum_{k=1}^{K-1}\gamma_{k}>1}]} \prod_{k=1}^{K-1}ber(\theta_{k}) \big]* \big[ \prod_{k=1}^{K-1}p(\theta_{k}) \big] * p(\theta_{K})^{\mathbf{1}[{\sum_{k=1}^{K-1}\gamma_{k}>1}]}$

The difference in two likelihood is that whether prior on $\theta_{K}$ should be add directly, or should be add after considering $\gamma_{1:(K-1)}?$