more efficient kmeans (no need to recalcualte the sums at each iteration)