format_output function

Run the EM for several values of K