function Main(input) {
  "use strict"
  const temp = input.split("\n")

  const nm = temp.shift().split(" ");
  const n = parseInt(nm.shift());
  const m = parseInt(nm.shift());
  const an = temp.shift().split(" ").map(e => parseInt(e));
  an.sort((a,b) => b - a);
  const arr = new Array(Math.ceil(Math.log2(an[0])) + 1).fill(0);
  const logAn = an.map(e => Math.ceil(Math.log2(e)));
  logAn.forEach(e => arr[e]++);

  let counter = m;
  for(let i = arr.length - 1; i > 0; i--){
    const e = arr[i];
    an.sort((a,b) => b - a);
    if(e < counter){
      if(i !== 0){
        for(let j = 0; j < e; j++){
          an[j] = an[j] / 2;
        }
        arr[i - 1] += e;
        counter -= e;
      }else{
        an.fill(0);
      }
    }else{
      for(let j = 0; j < counter; j++){
        an[j] = an[j] / 2;
      }
      break;
    }
  }

  console.log(an.reduce((acc, curr) => acc + Math.floor(curr), 0));
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
