inf and sup of a compact subset of R

Let K be a compact set

I have to show that for some a, b in K, we can show |a-p| = inf{|x-p|: x in K} and |b-p|=sup{|x-p|: x in K}

My proof

Since K is compact, K is closed and bounded. Since K is bounded, it is bounded above and below. that is, there is a B in R s.t. B>=x for all x in K. B is the least upper bound. Similarly, there is a A in R s.t. A <= x for all x in K. A is the greatest lower bound.

Let p<k for all k in K. Then choose a = min {values in K}. Then a inf|x-p| = |a-p|

Let p>k for all k in K. Then choose b=man {values in K}. Then sup|x-p|=|b-p|

I don't think my last part is right. Please provide me with some feedback