#include using namespace std; using LL = long long; const int mxn = 105; int n, k, a[mxn]; int f(int x) { return (x <= k) ? x : x / 2; } struct node { int delta, id; } b[mxn]; int main() { cin >> n >> k; for (int i = 1; i <= n; ++i) cin >> a[i]; for (int i = 1; i <= n; ++i) { b[i] = { f(a[i]) - (a[i] - f(a[i])), i }; } sort(b + 1, b + n + 1, [&](const node &lhs, const node &rhs) { return lhs.delta > rhs.delta; }); LL ans = 0; for (int i = 1; i <= n; ++i) { int p = b[i].id; if (i & 1) ans += f(a[p]); else ans += a[p] - f(a[p]); } printf("%lld\n", ans); return 0; }