Problem: Suppose $K$ is a compact subset of $\Bbb R^n$, and that for all $k_1, k_2 \in K$, there exists a continuous function $p:[0,1] \rightarrow K$ such that $p(0) = k_1 $ and $p_1 = k_2$. Then let $f: K \rightarrow \Bbb R$ be continous on $K$. Prove that there exists $k_{min}, k_{max}$ such that $f(K) = [f(k_{min}), f(k_{max})]$.
Thoughts: First since $K$ is compact it is closed and bounded. Next I know that I have to show two inclusions, namely that $f(K) \subset [f(k_{min}), f(k_{max})]$ and the reverse inclusion.
I also know that the composition $f(p(x))$ is continuous for $x \in [0,1]$, and I wish I could post more but I am very stuck. Hints much appreciated (emphasis that I want a hint and not a solution please). I am also aware of basic theorems like Extreme Value, Intermediate value etc.