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

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    int ans_low=0;
    for(auto c:s){
        if(islower(c)){
            ans_low++;
        }
    }
    if(ans_low>=k){
        cout<<n+k-ans_low;
    }else{
        if((k-ans_low)%2==0){
            cout<<n;
        }else{
            cout<<n-1;
        }
    }
    return 0;
}