#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
    int n,r; cin >> n >> r;
    vector<int> a(n);
    int left=0,happy=0;
    for(int i=0;i<n;++i) {
        cin >> a[i];
        r-=a[i]/2;
        happy+=2*(a[i]/2);
        if(a[i]&1!=0) {
            ++left;
        }
    }
    if(left>r) {
        happy+=2*r-left;
    }
    else {
        happy+=left;
    }
    cout << happy << "\n";
	return 0;
}