4. $[x]$ is the greatest integer not exceeding the real number $x$. It is known that the sequence $\left\{a_{n}\right\}$ satisfies
$$
a_{1}=\frac{3}{2}, a_{n+1}=a_{n}^{2}-a_{n}+1\left(n \in \mathbf{N}_{+}\right) \text {. }
$$

Then $m=\left[\sum_{k=1}^{2011} \frac{1}{a_{k}}\right]$ is . $\qquad$
4.1.
$$
\begin{array}{l}
\text { Given } a_{n+1}=a_{n}^{2}-a_{n}+1 \\
\Rightarrow a_{n+1}-1=a_{n}\left(a_{n}-1\right) \\
\Rightarrow \frac{1}{a_{n+1}-1}=\frac{1}{a_{n}-1}-\frac{1}{a_{n}} . \\
\text { Then } \frac{1}{a_{n}}=\frac{1}{a_{n}-1}-\frac{1}{a_{n+1}-1} . \\
\text { Therefore } m=\left[\frac{1}{a_{1}-1}-\frac{1}{a_{2012}-1}\right]=\left[2-\frac{1}{a_{2012}-1}\right]=1 .
\end{array}
$$