import java.util.Scanner; public class Main { private int[] sum; private int[] how; private int[] num; private int n; private int k; Main(){ sum = new int[10]; how = new int[10]; num = new int[10]; } //セッター public void setN(int n){ this.n = n; } public void setNum(int i,int a){ this.num[i] = a; } public void setK(int k){ this.k = k; } public void plusSum(int i,int num){ this.sum[i] += num; } //ゲッター public int getN(){ return this.n; } public int getK(){ return this.k; } public int getNum(int now){ return this.num[now]; } public int getSum(int now){ return this.sum[now]; } public int getHow(int now){ return this.how[now]; } //再帰 public int run(){ double re = this.saiki(0); return (int) Math.ceil(re); } private double saiki(int now){ if(now == getN()){ double max_h = 0.0,min_h = 100000000.0; boolean flag = false; for(int i = 0;i < getK();i++){ if(getSum(i) == 0) flag = true; double S = (double) getSum(i); double H = (double) getHow(i); max_h = Math.max(max_h, S / H); min_h = Math.min(min_h, S / H); } if(flag) return 0.0; return max_h - min_h; } int how_zero = 0; for(int i = 0;i < getK();i++){ if(getSum(i) == 0) how_zero++; } if(how_zero > getN() - now) return 0.0; double max_n = 0.0; for(int i = 0;i < getK();i++){ plusSum(i, getNum(now)); this.how[i]++; max_n = Math.max(saiki(now + 1),max_n); plusSum(i, -getNum(now)); this.how[i]--; } return max_n; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); Main m = new Main(); int n = sc.nextInt(); int k = sc.nextInt(); int a; m.setN(n); m.setK(k); for(int i = 0;i < n;i++){ a = sc.nextInt(); m.setNum(i, a); } System.out.println(m.run()); } }