n, m = map(int, input().split()) S = input() S = "x" + S + "x" ans = S.count("o") S = S.split("o") A = [] two = 0 one = 0 B = [] for T in S: if "x" not in T: le = len(T) if le == 1: ans += 1 elif le % 2 == 1: A.append(le // 2) else: two += le // 2 else: row = T.split("x") for i in range(len(row)): le = len(row[i]) if le == 0: continue if i == 0 or i == len(row) - 1: two += le // 2 if le % 2 == 1: one += 1 else: B.append(le) C = [] A.sort() for a in A: C += [2] * (a // 2 - 1) C += [3] C += [2] * two B.sort() for b in B: C += [1] if b % 2 == 0: b -= 1 one += 1 C += [2] * (b // 2) C += [1] * one ans += sum(C[:m]) print(ans)