#include <stdio.h>
#include<string.h>
#include<ctype.h>

int main()
{
    int n,k;
    char a[100002];
    scanf("%d %d %s",&n,&k,a);
    int countd=0;
    int countx=0;
    int sum=0;
    for(int i=0;i<strlen(a);i++)
    {
       if(isupper(a[i]))  countd++;
       else countx++;
    }
     if(countx>=k) sum+=(countd+k);
     else if(countx<k)
     {
           
           sum+=(countd+countx-1);
            if((k-countx+1)%2!=0)  sum++;
       
     }
     printf("%d",sum);
}