// Arup Guha
// 2/6/2015
// Solution to 2014 MCPC Problem H: Shrine Maintenance

import java.util.*;

public class h {

	final public static double R = 1000.0;

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int workers = stdin.nextInt();

		// Loop through cases.
		while (workers != 0) {

			int n = stdin.nextInt();
			int numD = stdin.nextInt();
			boolean[] visit = new boolean[n];

			// Mark each divisor's multiples as true.
			for (int i=0; i<numD; i++) {
				int div = stdin.nextInt();
				for (int j=div; j<=n; j+=div)
					visit[j-1] = true;
			}

			// Get sized list of shrines.
			ArrayList<Integer> shrines = new ArrayList<Integer>();
			for (int i=0; i<n; i++)
				if (visit[i])
					shrines.add(i);

			// Solve and print!
			System.out.printf("%.1f\n", solve(shrines, n, workers));

			// Get next case.
			workers = stdin.nextInt();
		}
	}

	public static double solve(ArrayList<Integer> shrines, int n, int workers) {

		// Fill in cumulative frequency array.
		int numS = shrines.size();
		double[] cumfreq = new double[2*numS+1];
		for (int i=1; i<cumfreq.length; i++)
			cumfreq[i] = cumfreq[i-1] + arc(shrines.get((i-1)%numS), shrines.get(i%numS), n);

		// Stores result without extra 2000.
		double best = 1e9;

		// Try each starting point and update as necessary.
		for (int start=1; start<=numS; start++) {
			int minSeg = binSearch(shrines, cumfreq, start, numS, workers);
			best = Math.min(best, cumfreq[start+minSeg] - cumfreq[start]);
		}

		// This is our answer, add the trip to first shrine and from last shrine.
		return best + 2*R;
	}

	public static int binSearch(ArrayList<Integer> shrines, double[] cumfreq, int start, int numS, int workers) {

		int low = 0, high = numS;

		// Run binary search on how many segments this guy walks.
		while (low < high-1) {

			int mid = (low+high)/2;
			boolean works = greedy(shrines, cumfreq, start, numS, workers, mid);

			// Update bounds of search.
			if (!works) low = mid+1;
			else        high = mid;

		}

		// Find smallest that works.
		while (!greedy(shrines, cumfreq, start, numS, workers, low)) low++;

		// Here is the answer.
		return low;
	}

	public static boolean greedy(ArrayList<Integer> shrines, double[] cumfreq, int start, int numS, int workers, int tryVal) {

		// Special case.
		if (workers == 1) return tryVal >= numS-1;

		// This is how much this first worker is walking.
		double max = cumfreq[start+tryVal] - cumfreq[start];
		int index = start+tryVal+1;

		// Go through the rest of the workers.
		for (int i=1; i<workers; i++) {

			// Force this one to walk less than the first.
			double cur = 0;
			int nextIndex = index;
			while (cur < max+1e-9 && nextIndex < start+numS && nextIndex < cumfreq.length) {
				nextIndex++;
				cur = cumfreq[nextIndex] - cumfreq[index];
			}

			// We made it!
			if (nextIndex >= start+numS) return true;

			// Update our starting point.
			index = nextIndex;
		}

		// If we get here, we didn't make it.
		return false;
	}

	public static double arc(int start, int end, int n) {

		// Get difference between successive spots.
		int diff = Math.abs(end - start);
		diff = Math.min(diff, n-diff);

		// Get angle and chord length.
		double angle = 1.0*diff/n*2*Math.PI;
		return Math.sqrt(2*R*R*(1 - Math.cos(angle)));
	}
}