import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); int M = scanner.nextInt(); ArrayList<Double> weight = new ArrayList<>(); for (int i = 0; i < N; i++) { weight.add(scanner.nextDouble()); } Collections.sort(weight, new Comparator<Double>() { @Override public int compare(Double o1, Double o2) { if (o1 > o2) { return 1; }else if (o1 == o2){ return 0; }else return -1; } }); double smallValue = weight.get(M-1) - weight.get(0); double maxSum = 0.00; for (int i = 0; i < N-M; i++) { double sum = 0.0; double differValue = weight.get(i+M-1) - weight.get(i); for (int j = 0; j < M; j++) { sum += weight.get(i+j); } if (differValue <= smallValue){ smallValue = differValue; maxSum = sum; } } System.out.printf("%.2f",maxSum); } }