Kmeans 2D working with termination