// Arup Guha
// 1/23/2013
// Solution to 2011 Mercer Problem: Optimal Grading
import java.util.*;

public class prob9 {

	public final static double LN2 = Math.log(2);

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);

		int n = stdin.nextInt();
		int m = stdin.nextInt();

		while (n!=0) {

			// Populate a frequency array of the scores.
			int[] freq = new int[10000];
			for (int i=0; i<n; i++) {
				int score = stdin.nextInt();
				freq[score]++;
			}

			// Calculate the number of unique scores.
			int numVals = 0;
			for (int i=0; i<freq.length; i++)
				if (freq[i] > 0)
					numVals++;

			// Stores the positive frequencies in the order they appeared
			// in the original frequency array.
			int[] input = new int[numVals];
			int  j=0;
			for (int i=0; i<10000; i++) {
				if (freq[i] > 0) {
					input[j] = freq[i];
					j++;
				}
			}

			// Output the answer.
			System.out.printf("%.2f\n", maxEntropy(input, m+1));

			// Start reading in the next case.
			n = stdin.nextInt();
			m = stdin.nextInt();
		}
	}

	// Returns the maximum entropy possible by splitting the set of numbers in input
	// into numGroups number of contiguous groups.
	public static double maxEntropy(int[] input, int numGroups) {

		// Simple base cases.
		if (numGroups == 0 || input.length == 1) return 0;

		int numValues = input.length;
		int sum = 0;
		int[] cumulative = new int[numValues];

		// Calculate cumulative sums.
		for (int i=0; i<numValues; i++) {
			sum += input[i];
			cumulative[i] = sum;
		}

		double[][] dp = new double[numGroups][numValues];

		// Fill in row of "partial entropies" for one group.
		for (int i=0; i<numValues; i++) {
			double ratio = (double)sum/cumulative[i];
			dp[0][i] = 1.0/ratio*Math.log(ratio)/LN2;
		}

		// Loop through number of groups (which is offset by 1).
		for (int i=1; i<numGroups; i++) {

			// You can't form more groups, so just copy the number from above.
			for (int j=0; j<i && j<numValues; j++)
				dp[i][j] = dp[i-1][j];

			// Fill in the rest of the values.
			for (int j=i; j<numValues; j++) {

				// Set initial entropy by grouping last item by itself.
				double ratio = (double)sum/input[j];
				double max = dp[i-1][j-1] + 1.0/ratio*Math.log(ratio)/LN2;

				// Try all other last groups. (A fairly big optimization can be made here which I haven't made.)
				// There are only two sums worth building off of, at most...
				for (int k=j-2; k>=i-1; k--) {
					ratio = (double)sum/(cumulative[j]-cumulative[k]);
					double temp = dp[i-1][k] + 1.0/ratio*Math.log(ratio)/LN2;
					if (temp > max)
						max = temp;
				}

				dp[i][j] = max;
			}
		}

		// This is the final answer we want.
		return dp[numGroups-1][numValues-1];
	}
}