Arkady decided to buy roses for his girlfriend.

A flower shop has white, orange and red roses, and the total amount of them is *n*. Arkady thinks that red roses are not good together with white roses, so he won't buy a bouquet containing both red and white roses. Also, Arkady won't buy a bouquet where all roses have the same color. 

Arkady wants to buy exactly *k* roses. For each rose in the shop he knows its beauty and color: the beauty of the *i*-th rose is *b*<sub class="lower-index">*i*</sub>, and its color is *c*<sub class="lower-index">*i*</sub> ('W' for a white rose, 'O' for an orange rose and 'R' for a red rose). 

Compute the maximum possible total beauty of a bouquet of *k* roses satisfying the constraints above or determine that it is not possible to make such a bouquet.
The first line contains two integers *n* and *k* (1 ≤ *k* ≤ *n* ≤ 200 000) — the number of roses in the show and the number of roses Arkady wants to buy.

The second line contains a sequence of integers *b*<sub class="lower-index">1</sub>, *b*<sub class="lower-index">2</sub>, ..., *b*<sub class="lower-index">*n*</sub> (1 ≤ *b*<sub class="lower-index">*i*</sub> ≤ 10 000), where *b*<sub class="lower-index">*i*</sub> equals the beauty of the *i*-th rose.

The third line contains a string *c* of length *n*, consisting of uppercase English letters 'W', 'O' and 'R', where *c*<sub class="lower-index">*i*</sub> denotes the color of the *i*-th rose: 'W' denotes white, 'O'  — orange, 'R' — red.
In the first example Arkady wants to buy 3 roses. He can, for example, buy both red roses (their indices are 1 and 2, and their total beauty is 7) and the only orange rose (its index is 3, its beauty is 4). This way the total beauty of the bouquet is 11. 

In the second example Arkady can not buy a bouquet because all roses have the same color.
5 3
4 3 4 1 6
RROWW
11
5 2
10 20 14 20 11
RRRRR
-1
11 5
5 6 3 2 3 4 7 5 4 5 6
RWOORWORROW
28
15 10
8560 6244 9607 5137 7187 3217 5527 9919 282 8748 3529 6110 5767 521 3393
OWRWOORWRORWWRO
64282
10 4
1208 5835 2637 5827 3722 6837 3499 6438 43 5333
WRRWRWRWRW
-1
13 3
9675 8988 5499 6356 5083 6067 5580 4580 6735 3617 9536 8218 3265
RRWRRROWRWWWW
24243
13 7
8543 3460 1282 3956 8203 762 6059 9361 4427 8868 5849 3439 8891
WWOOOOWOWWRWO
54352
30 15
7926 577 5009 7237 4395 3239 8994 4429 8126 2925 139 320 4442 3397 1292 2800 9505 6043 5946 8058 4031 6871 4689 1977 73 440 5320 5290 4707 387
OOWOWWORRWOWORWRRRRWORROOWWROW
91633
1 1
100
O
-1
1 1
1059
O
-1
2 2
9907 4483
OO
-1
1 1
6750
W
-1
2 2
144 174
OW
318
3 2
776 4797 9449
OWO
14246
2 2
3486 8968
WW
-1
3 2
2330 2140 3440
WOW
5580
4 2
1175 8186 4321 1810
WWOO
12507
1 1
6479
R
-1
2 2
8512 9903
OR
18415
3 2
7035 5046 7357
OOR
14392
2 2
6442 4558
WR
-1
3 2
9700 698 2122
OWR
11822
4 3
254 4510 2194 9543
WOOR
16247
3 2
517 6744 2364
RWW
-1
4 2
2884 2918 8629 9905
RWOW
18534
5 2
7882 871 789 4432 7664
OWORW
15546
2 2
2926 8428
RR
-1
3 2
7926 1770 3255
ORR
11181
4 2
2578 7910 108 3809
OROR
10488
3 2
5920 9303 7542
WRR
-1
4 2
5909 4286 5444 6473
OWRR
12382
5 2
96 6627 8780 3764 970
RROWO
15407
4 2
6657 1489 9138 4273
RRWW
-1
5 2
1598 6700 334 6455 9292
WORWR
15992
6 2
6231 9178 9845 5932 5477 6659
ORRWOW
16076
1 1
780
O
-1
1 1
3214
W
-1
2 2
8455 5432
OW
13887
1 1
6555
R
-1
2 2
1120 5670
OR
6790
3 2
8884 4514 1673
ORW
13398
1 1
6908
O
-1
1 1
3934
W
-1
2 2
8856 7299
WO
16155
1 1
2683
R
-1
2 2
9094 5772
RO
14866
3 2
518 9438 7938
WOR
17376
10 4
9513 754 5917 1337 2337 1387 3499 9873 9138 7647
WROWWOWWRO
32950
20 5
3747 219 7826 7713 6886 466 1136 7069 1234 7556 3657 6017 9965 2847 6880 362 3179 4676 5934 4913
WWWOWOWOWOROWOWWWOWW
40129
import unittest
from itertools import combinations


def problem_h(n, k, b, c):
    # map roses to their weight
    # shop = zip(b, c)
    # roses stack by color
    if len(set(c)) == 1:
        return -1

    whites, reds, oranges = list(), list(), list()
    for beauty, color in zip(b, c):
        if color == 'R':
            reds.append((color, beauty))
        elif color == 'O':
            oranges.append((color, beauty))
        else:
            whites.append((color, beauty))

    # sort by their beauty
    # whites.sort(reverse=True)
    # oranges.sort(reverse=True)
    # reds.sort(reverse=True)

    # check if the monotone
    possible_compositions = []
    whites_and_oranges = whites + oranges
    reds_and_oranges = reds + oranges

    w_o_combinations = list(combinations(whites_and_oranges, k))
    r_o_combinations = list(combinations(reds_and_oranges, k))

    for combination in w_o_combinations:
        if len(set([x[0] for x in combination])) == 1:
            continue
        possible_compositions.append(sum(x[1] for x in combination))

    for combination in r_o_combinations:
        if len(set([x[0] for x in combination])) == 1:
            continue
        possible_compositions.append(sum(x[1] for x in combination))

    try:
        return max(possible_compositions)
    except:
        # the number of possible compositions is 0, can not create bouquet
        return -1


def main():
    n, k = [int(x) for x in input().split(' ')]
    b = [int(x) for x in input().split(' ')]
    c = input()

    print(problem_h(n, k, b, c))


class Codeforces926TestCase(unittest.TestCase):
    def test_example_1(self):
        self.assertEqual(11, problem_h(5, 3, [4, 3, 4, 1, 6], 'RROWW'))

    def test_example_2(self):
        self.assertEqual(-1, problem_h(5, 2, [10, 20, 14, 20, 11], 'RRRRR'))
        self.assertEqual(-1, problem_h(5, 2, [10, 20, 14, 20, 11], 'OOOOO'))
        self.assertEqual(-1, problem_h(5, 2, [10, 20, 14, 20, 11], 'WWWWW'))

    def test_example_3(self):
        self.assertEqual(28, problem_h(11, 5, [5, 6, 3, 2, 3, 4, 7, 5, 4, 5, 6], 'RWOORWORROW'))

    def test_not_possible(self):
        self.assertEqual(-1, problem_h(1, 1, [10], 'R'))
        self.assertEqual(-1, problem_h(1, 1, [10], 'O'))
        self.assertEqual(-1, problem_h(1, 1, [10], 'W'))


if __name__ == '__main__':
    main()
