kmeans loop