Minimum Substring Length#12781

Minimum Substring Length

2 seconds
256 megabytes
Easy

You are given a string of length , consisting only of the characters R, G, and B.

You need to find a substring s_l s_{l+1}\ldots s_r that contains exactly characters G.

Among all such substrings, find the minimum possible length.

It is guaranteed that the string contains at least characters G.

Input

The first line contains two integers and (1 \le k \le n \le 2 \cdot 10^5) — the length of the string and the required number of G characters, respectively.

The second line contains a string of length , consisting only of the characters R, G, and B.

It is guaranteed that the string contains at least characters G.

Output

Print one integer — the minimum length of a substring that contains exactly characters G.

Examples

Example 1

Loading
Loading

Note

The substring s_4s_5s_6s_7=GRGG has length and contains exactly characters G.

No substring of length less than contains exactly characters G.

Therefore, the answer is .

Scoring

  1. Subtask ( points): n \le 1000.

  2. Subtask ( points): there does not exist a triple of indices i<j<k such that s_i=s_k and s_i\ne s_j.

  3. Subtask ( points): No additional constraints.