The robot moves on a field consisting of cells arranged in a row. Each cell contains a cube of a certain color.
At the beginning, the robot is in the first cell of the field and does not hold any cubes. While in a cell, the robot can perform each of the following actions at most once: (1) place a cube of the same color as the one currently in the cell; (2) pick up the cube that was initially in the cell. After this, the robot moves to the next cell, or stops if the current cell is the last one on the field.
The robot can hold at most cubes at the same time. When the robot stops, it must not be holding any cubes.
Write a program that, given the colors of the cubes and the limitation on the number of cubes the robot can hold at once, determines the maximum total number of cubes the robot can move from place to place, moving through the field.
The first line contains a string of length (1 \leq N \leq 1000). The string consists of lowercase Latin letters. Each letter corresponds to a field cell and determines the color of the cube in that cell. The second line contains the limit (1 \leq K \leq 25) — the maximum number of cubes the robot can hold at the same time.
Output a single integer — the maximum number of cubes whose location the robot can change while moving through the field.
Example 1