main=do
 [n,k]<-map read.words<$>getLine
 s<-getLine
 let a=f s
 let b=if head s=='L' then a++[1] else a
 let c=if last s=='R' then b++[1] else b
 let d=drop k c
 print$(n-)$sum$if length d==0 then [1] else d
f('R':'L':x)=2:f x
f(c:x)=f x
f[]=[]