keep k from going above the number of data points in the n-means algorithm