This might be massive overkill, but you might want to look into hierarchical clustering algorithms. These algorithms group together values into a hierarchy, from which you can easily extract the best k clusters. Agglomerative clustering is probably the easiest of these approaches to implement, and from experience it tends to produce very good clusters.
Hope this helps!