k-means is a non-hierarchical clustering algorithm that requires the number of clusters (k) to be specified in advance.
Viewed as a mixture density estimation problem, however, it is possible to estimate the value of k from the data. See e.g. ``Markov Chain Monte Carlo in Practice'', Gilks et al.