Under construction

Still being built. Things may change

Novel

Interview

Time limit1sMemory limit1024 MB

Summary
Find the largest line width L so that no K identical lowercase letters appear consecutively within a single line of the string.
Level

Medium4 of 10

Topics
String, Implementation, Math
Solved
No attempts yet

Problem

Today, September 24, is a very important day for Seohyeon, a boy who loves literature. It is the day the novel he spent years writing is released to the world!

Seohyeon's novel can be represented as a string SS of length NN. For convenience, SS consists only of lowercase English letters. No characters other than lowercase letters, including spaces or newline characters, appear in SS.

While reviewing the final draft, Seohyeon found a serious problem. If KK or more identical characters appear consecutively in one line, the readability drops badly!

To spare readers from discomfort, Seohyeon wants to choose a page width LL, an integer from 1 to NN, so that this case does not occur. A narrower page is harder to read, so he wants LL to be the largest possible value.

When the width is set to LL, the first LL characters of SS are shown on the first line, the next LL characters on the next line, and so on, with LL characters per line. Only the last line may show fewer than LL characters.

SNUPC ends at the same time Seohyeon's novel is published, so he must revise the book quickly. Find the largest valid value of LL.

Input

The first line contains NN and KK, separated by a space. (2≤N≤100 0002\le N\le 100\,000; 2≤K≤N2\le K\le N)

The second line contains the string SS of length NN, made of lowercase English letters.

Output

Print the maximum possible width.

Examples1

  1. Example 1

    Input
    6 2
    abccde
    
    Expected output
    3