// Arup Guha
// 11/6/2016
// Solution to 2016 SER Division 2 Problem: Project Panoptes

import java.util.*;

public class panoptes {

	public static int n;
	public static int minP;
	public static double[] readings;

	public static void main(String[] args) {

		// Read in input.
		Scanner stdin = new Scanner(System.in);
		n = stdin.nextInt();
		minP = stdin.nextInt();
		readings = new double[n];
		for (int i=0; i<n; i++)
			readings[i] = stdin.nextDouble();

		// Solve it.
		System.out.println(solve());
	}

	public static int solve() {

		// Get average.
		double avg = 0;
		for (int i=0; i<n; i++)
			avg += readings[i];
		avg /= n;

		// Find dim days.
		boolean[] dim = new boolean[n];
		for (int i=0; i<n; i++)
			if (readings[i] < .8*avg)
				dim[i] = true;

		// Try period p.
		for (int p=minP; p<=n; p++) {

			// This is where we start.
			for (int start=0; start<p; start++) {

				// See if these are all dim.
				boolean ok = true;
				for (int i=start; i<n; i+=p) {
					if (!dim[i]) {
						ok = false;
						break;
					}
				}

				// If they are, we're done.
				if (ok) return p;
			}
		}

		// Never worked.
		return -1;
	}
}