Order statistics of vectors with dependent coordinates, and the Karhunen-Loève basis