How to find the MLE for $\theta$ in terms of K and n this is my first question here :)
This was seen in a machine learning exam:
Suppose that $X_1 ...X_n$ are n  i.i.d random variables with the following distribution:
$f(x;\theta) = \begin{cases}
      \theta & x=-1\\
      (1-\theta)^2\theta^x & x=0,1,2,...
    \end{cases}$
Suppose that K is the number of times observations are equal to -1. Find a compact expression for the maximum likelihood estimator of $\theta$ in terms of K and n.
The problem Is that I can not find a way to represent the likelihood function. I tried to approach it as a binomial distribution and multiply the two probabilities with a binomial coefficient but I did not succeed and it might be stupid.
I am a little bit confused by the meaning of K and the $x_i$,
K is the number of times we saw -1, but $x_i$ is actually the number we have seen, combining those two things in one formula is what I failed to do.
can you please guide me to the right way to think about it?

The likelihood given the sample $x_1,x_2,\ldots,x_n$ is
$$
L(\theta\mid x_1,\ldots,x_n)=\left(\prod_{i:x_i=-1}\theta \right)\left(\prod_{i:x_i\ge 0}(1-\theta)^2 \theta^{x_i}\right) \quad,\,\theta \in (0,1) \tag{1}
$$
Now $K$ is the number of observations equal to $-1$, i.e. $K=\sum_{i=1}^n I(x_i=-1)$. There are $n-K$ remaining observations. Therefore, $(1)$ reduces to
$$L(\theta\mid x_1,\ldots,x_n)=\theta^K \cdot (1-\theta)^{2(n-K)}\theta^{\sum_{i=1}^n x_iI(x_i\ge 0)} \quad,\,\theta \in (0,1)\tag{2}$$
The resulting MLE of $\theta$ is straightforward to derive.
