Suki's Toy Parade
Suki has dragged every toy she owns out of her basket and lined them up along the hallway: n toys in a row, numbered 1 to n from the door. Toy i is of type t_i (all pink balls share one type, all squeaky ducks another, and so on) and gives her v_i joy. Before her walk she wants to parade exactly k consecutive toys past the neighbors' cat, and a proper parade never shows the same type of toy twice.
Choose a stretch of exactly k consecutive toys l, l+1, …, l+k−1 whose types are pairwise distinct, so that its total joy v_l + v_{l+1} + … + v_{l+k−1} is as large as possible. Print that total, or -1 if every stretch of k consecutive toys contains two toys of the same type.
Input
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 2·10^5).
The second line contains n integers t_1, t_2, …, t_n (1 ≤ t_i ≤ 10^9), the toy types.
The third line contains n integers v_1, v_2, …, v_n (1 ≤ v_i ≤ 10^9), the joy values.
Output
Print one integer: the largest total joy of a stretch of exactly k consecutive toys with pairwise distinct types, or -1 if there is no such stretch.
Notes
In the first example the stretches of three toys are (types) 1 2 1, 2 1 3, 1 3 2, 3 2 4 and 2 4 4. The first and last repeat a type; the others have totals 12, 19 and 13, so the answer is 19.
In the second example both stretches of three toys contain two toys of type 5, so the answer is -1.
In the third example the only stretch is the whole row, with total 3·10^9: totals can exceed 2^31, so use 64-bit integers.