// Arup Guha
// 2/3/2020
// Solution to 2020 January Silver USACO Problem: Berry Picking

import java.util.*;
import java.io.*;

public class berries {
	
	public static void main(String[] args) throws Exception {
		
		Scanner stdin = new Scanner(new File("berries.in"));
		int n = stdin.nextInt();
		int k = stdin.nextInt();
		int[] items = new int[n];
		for (int i=0; i<n; i++)
			items[i] = stdin.nextInt();
		
		int res = 0;
		
		// Try i as the number of berries Elsie gets.
		for (int i=1; i<=1000; i++) 
			res = Math.max(res, go(items, i, k/2));
		
		// Output result.
		PrintWriter out = new PrintWriter(new FileWriter("berries.out"));
		out.println(res);
		out.close();		
		stdin.close();
	}
	
	public static int go(int[] items, int limit, int baskets) {
		
		// Set up our priority queue.
		PriorityQueue<Integer> pq = new PriorityQueue<>(10, Collections.reverseOrder());
		for (int x: items) pq.offer(x);
		
		// Have Elsie take exactly limit berries each time.
		for (int i=0; i<baskets; i++) {
			if (pq.size() == 0) return -1;
			int next = pq.poll();
			if (next < limit) return -1;
			if (next > limit) pq.offer(next-limit);
		}
		
		int bessie = 0, cnt = 0;
		
		// Now it's bessie's turn.
		while (pq.size() > 0 && cnt < baskets) {
			
			// Get next.
			int next = pq.poll();
			cnt++;
			
			// Just have Bessie take limit also.
			if (next > limit) {
				bessie += limit;
				pq.offer(next-limit);
			}
			
			// Here she takes the whole thing.
			else
				bessie += next;
		}
		
		// Total we get.
		return bessie;
	}
}
	