Showing a function is unbounded
Solution 1:
Let $x_0=2\pi n$ where $n\in\Bbb Z^+$ is large enough that
$2\pi n(\cos 1)-1\ge k$ and $2\pi n>M.$
If $x\in [x_0,x_0+1/k]$ then $\cos x=\cos (x-2\pi n)\ge \cos 1>0$ so $$f(x)=x\cos x+\sin x\ge 2\pi n\cos x-|\sin x|\ge$$ $$\ge 2\pi n(\cos 1)-|\sin x|\ge$$ $$\ge 2\pi n(\cos 1)-1\ge k.$$