#include <bits/stdc++.h>

using ll = long long;
using namespace std;

#define swap(a, b)    do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(false)
#define repd(i, a, b) for(typeof(b) i = a; i < (b); ++i)
#define rep(i, n)     repd(i, 0, n)
#define dump(x)       cerr << #x << " = " << (x) << endl
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YN(x)         cout << ((x) ? "YES" : "NO") << endl
#define Yn(x)         cout << ((x) ? "Yes" : "No") << endl
#define yn(x)         cout << ((x) ? "yes" : "no") << endl
#define absi(x)       ( ((x) >= 0) ? (x) : (-(x)) )
#define debugvec(v)   rep(i, v.size()) cerr << "L" << __LINE__ << ": " << #v << "[" << i << "] = " << v[i] << endl;
#define debugvec2(v)  cerr << "L" << __LINE__ << ": " << #v << " = { "; rep(i, v.size()) cerr << v[i] << (i + 1 == v.size() ? "" : ", "); cerr << " }" << endl;

ll gcd(ll a, ll b) { return __gcd(a, b); }
ll lcm(ll a, ll b) { return (a == 0 || b == 0) ? 0 : (a / __gcd(a, b) * b); }

class indexsegmenttree {
public:
	using vtype = long long;
	std::vector<vtype> values;
	std::vector<std::size_t> v; // index を格納する

	static const vtype identity_element;
	static const std::size_t invalid_index; // ネーミングが微妙

private:
	std::size_t n;         // 実際の配列要素数

	std::size_t find_index_(const std::size_t required_l, const std::size_t required_r,
	                        const std::size_t targeted_l, const std::size_t targeted_r,
	                        const std::size_t current_index) const {
		/* 要求区間と対象区間とが交わらない場合、単位元を返す */
		if(targeted_r <= required_l || required_r <= targeted_l) {
			return invalid_index;
		}

		/* 要求区間が対象区間に真に含まれる場合、その場所の値を返す */
		if(required_l <= targeted_l && targeted_r <= required_r) {
			return v.at(current_index);
		}

		/* 要求区間と対象区間とが一部で交わる場合、子について探索 */
		return select_index(
			find_index_(required_l, required_r, targeted_l, (targeted_l + targeted_r) / 2, current_index * 2 + 1),
			find_index_(required_l, required_r, (targeted_l + targeted_r) / 2, targeted_r, current_index * 2 + 2)
		);
	}



	void init(const vector<vtype>& iv) {
		n = iv.size();
		values = iv;
		values.resize(calculate_virtual_n(iv.size()), indexsegmenttree::identity_element);
		v = vector<std::size_t>(values.size() * 2 - 1, invalid_index);

		for(std::size_t i = 0; i < n; ++i) {
			v.at(i + values.size() - 1) = i;
		}

		for(std::size_t i = values.size() - 1; i > 0; --i) {
			v.at(i-1) = select_index( v.at(2*i - 1), v.at(2*i) );
		}
	}

public:
	indexsegmenttree(const std::size_t n0) {
		init(std::vector<vtype>(n0, indexsegmenttree::identity_element));
	}

	indexsegmenttree(const vector<vtype>& iv) {
		init(iv);
	}

	vtype get(const std::size_t index) const {
		return values.at(index);
	}

	void set(const std::size_t index, const vtype value) {
		values.at(index) = value;

		std::size_t i = index + values.size() - 1;
		while(i > 0) {
			i = (i - 1) / 2;
			v.at(i) = select_index( v.at(2*i + 1),  v.at(2*i + 2) );
		}
	}

	void update(const std::size_t index, const vtype value) {
		set(index, value);
	}

	/* 半開区間 [l, r) を対象とする */
	vtype find(const std::size_t l, const std::size_t r) const {
		return get(find_index(l, r));
	}

	std::size_t find_index(const std::size_t l, const std::size_t r) const {
		if(l >= r) {
			std::stringstream errmsg;
			errmsg << "indexsegmenttree::find_index: l (which is " << l << ") >= r (which is " << r << ")";
			throw std::out_of_range(errmsg.str());
		}

		if(n < r) {
			std::stringstream errmsg;
			errmsg << "indexsegmenttree::find_index: r (which is " << r << ") > n (which is " << n << ")";
			throw std::out_of_range(errmsg.str());
		}

		return find_index_(l, r, 0, values.size(), 0);
	}

	std::size_t size() const {
		return n;
	}

	std::size_t virtual_size() const {
		return values.size();
	}

	/* for debug */
	void print(const std::size_t space_size = 1) const {
		/* v の印字桁数 */
		vector<std::size_t> v_print_size(v.size());
		for(std::size_t i = 0; i < v.size(); ++i) {
			std::stringstream ss;
			ss << v.at(i);
			v_print_size.at(i) = ss.str().size();
		}

		/* values の印字桁数 */
		vector<std::size_t> values_print_size(values.size());
		for(std::size_t i = 0; i < values.size(); ++i) {
			std::stringstream ss;
			ss << values.at(i);
			values_print_size.at(i) = ss.str().size();
		}

		/* 葉の最大印字数（values も考慮） */
		std::size_t max_leaf_size = 0;
		for(std::size_t i = 0; i < n; ++i) {
			max_leaf_size = std::max({ max_leaf_size, values_print_size.at(i), v_print_size.at(i + values.size() - 1) });
		}

		/* ノードに対応する箱のサイズを求める */
		vector<std::size_t> box_size(v.size(), 0);
		for(std::size_t i = 0; i < values.size(); ++i) {
			box_size.at(i + values.size() - 1) = max_leaf_size + 2 * space_size; // 葉
		}
		for(std::size_t i_ = values.size() - 1; i_ > 0; --i_) {
			const std::size_t i = i_ - 1;
			box_size.at(i) = box_size.at(2*i+1) + box_size.at(2*i+2);
		}

		/* 実処理 */
		std::vector<std::string> es({"\x1b[41m", "\x1b[45m", "\x1b[42m", "\x1b[44m"}); // escape sequence
		for(std::size_t i = 0; (1 << i) <= values.size(); ++i) {   // (1 << i) = 同じ階層にあるノードの数
			for(std::size_t j = 0; j < (1 << i); ++j) {        // j = 階層内での index
				const std::size_t index = (1 << i) + j - 1;    // index = 本来の添字
				const std::size_t right_space = (box_size.at(index) - v_print_size.at(index)) / 2;
				const std::size_t left_space  = box_size.at(index) - v_print_size.at(index) - right_space;

				std::cout << es.at( ( (i % 2 == 0) ? 2 : 0 ) + ( (j % 2 == 0) ? 1 : 0 ) );

				if( v.at(index) != invalid_index ) {
					std::cout << std::string(left_space, ' ') << v.at(index) << std::string(right_space, ' ');
				} else {
					std::cout << std::string(space_size, ' ')
					          << std::string(box_size.at(index) - space_size * 2, 'X')
					          << std::string(space_size, ' ');
				}
				std::cout << "\x1b[m";
			}
			std::cout << std::endl;
		}

		std::vector<std::string> es2({"\x1b[47m\x1b[30m", "\x1b[46m\x1b[30m"}); // escape sequence
		for(std::size_t i = 0; i < values.size(); ++i) {
			const std::size_t right_space = (box_size.at(i + values.size() - 1) - values_print_size.at(i)) / 2;
			const std::size_t left_space  =  box_size.at(i + values.size() - 1) - values_print_size.at(i) - right_space;

			std::cout << es2.at( (i % 2 == 0) ? 0 : 1 )
			          << std::string(left_space, ' ') << values.at(i) << std::string(right_space, ' ')
			          << "\x1b[m";
		}
		std::cout << std::endl;
	}

	std::size_t select_index(const std::size_t i1, const std::size_t i2) const {
		if( i1 == invalid_index ) return i2;
		if( i2 == invalid_index ) return i1;

		return ( operate( get(i1), get(i2) ) == get(i1) ) ? i1 : i2;
	}

	static vtype operate(const vtype a, const vtype b) {
		return std::max(a, b);
	}

	static std::size_t calculate_virtual_n(const std::size_t n) {
		if( n == 0 ) return 0;
		if( (n & (n-1)) == 0 ) return n;
		
		std::size_t ret = 1;
		std::size_t n_ = n;
		while(n_ > 0) {
			ret <<= 1;
			n_ >>= 1;
		}
		return ret;
	}
};

const indexsegmenttree::vtype indexsegmenttree::identity_element = 0;//LLONG_MAX;
const std::size_t indexsegmenttree::invalid_index = std::numeric_limits<std::size_t>::max();

int main(int argc, const char* argv[]) {
	ll n, m;
	cin >> n >> m;
	vector<ll> a(n);
	rep(i, n) {
		cin >> a.at(i);
	}

	indexsegmenttree ist(a);

	rep(i, m) {
		std::size_t j = ist.find_index(0, n);
		ist.set(j, ist.get(j) / 2);
	}

	ll ret = 0;
	rep(i, n) {
		ret += ist.get(i);
	}

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 4080