import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int m = sc.nextInt(); long[] values = new long[n + 1]; for (int i = 1; i <= n; i++) { values[i] = sc.nextInt() + values[i - 1]; } long[][] dp = new long[n + 1][m + 2]; int[][] lasts = new int[n + 1][m + 2]; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m + 1; j++) { dp[i][j] = Long.MIN_VALUE; for (int k = i - 1; k >= 0; k--) { if (j % 2 == 0) { if (dp[i][j] < dp[k][j - 1] - values[i] + values[k]) { dp[i][j] = dp[k][j - 1] - values[i] + values[k]; lasts[i][j] = k; } } else { if (dp[i][j] < dp[k][j - 1] + values[i] - values[k]) { dp[i][j] = dp[k][j - 1] + values[i] - values[k]; lasts[i][j] = k; } } } } } long ans = Long.MIN_VALUE; int idx = 0; for (int i = 0; i < m + 2; i++) { if (ans < dp[n][i]) { ans = dp[n][i]; idx = i; } } ArrayDeque list = new ArrayDeque<>(); int current = n; while (idx > 0) { list.push(lasts[current][idx]); current = lasts[current][idx]; idx--; } list.pop(); int count = m - list.size(); StringBuilder sb = new StringBuilder(); while (list.size() > 0) { sb.append(list.pop()).append("\n"); } for (int i = 0; i < count; i++) { sb.append(n).append("\n"); } System.out.print(sb); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String nextLine() throws Exception { return br.readLine(); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }