n,k = gets.split.map(&:to_i)
rsp = gets.split.map(&:to_i)
t = gets.chomp

def point(x)
    if x == 'r'
        2
    elsif x == 's'
        0
    else
        1
    end
end

dp = Array.new(n,true)
ans = 0

0.upto(k-1) {|i| ans += rsp[point(t[i])]}

k.upto(n-1) do |i|
    if t[i] == t[i-k]
        if dp[i-k]
            dp[i] = false
        else
            ans += rsp[point(t[i])]
        end
    else
        ans += rsp[point(t[i])]
    end
end

p ans