import std.stdio, std.conv, std.string, std.range, std.algorithm, std.array, std.functional;

ulong _f(int[] A, int n, int m) {
  if(n == 1) return A[0] >> m;
  int a = A[n-1];
  ulong mx = 10000000000;
  int y = 0;
  while(y <= m && (a<<1) > (1<<y)) {
    auto yen = f(A, n-1,m-y) + (a>>y);
    mx = min(mx, f(A, n-1, m-y) + (a>>y));
    y++;
  }
  return mx;
}

alias f = memoize!_f;

void main() {
  auto input = readln.split.to!(int[]);
  auto N = input[0], M = input[1];
  auto A = readln.split.to!(int[]);

  f(A, N, M).writeln;
}
