The only difference between the easy and the hard versions is constraints.

A subsequence is a string that can be derived from another string by deleting some or no symbols without changing the order of the remaining symbols. Characters to be deleted are not required to go successively, there can be any gaps between them. For example, for the string "abaca" the following strings are subsequences: "abaca", "aba", "aaa", "a" and "" (empty string). But the following strings are not subsequences: "aabaca", "cb" and "bcaa".

You are given a string s consisting of n lowercase Latin letters.

In one move you can take any subsequence t of the given string and add it to the set S. The set S can't contain duplicates. This move costs n - |t|, where |t| is the length of the added subsequence (i.e. the price equals to the number of the deleted characters).

Your task is to find out the minimum possible total cost to obtain a set S of size k or report that it is impossible to do so.

Input

The first line of the input contains two integers n and k (1 ≤ n ≤ 100, 1 ≤ k ≤ 10^{12}) — the length of the string and the size of the set, correspondingly.

The second line of the input contains a string s consisting of n lowercase Latin letters.

Output

Print one integer — if it is impossible to obtain the set S of size k, print -1. Otherwise, print the minimum possible total cost to do it.

Examples

Input


4 5
asdf


Output


4


Input


5 6
aaaaa


Output


15


Input


5 7
aaaaa


Output


-1


Input


10 100
ajihiushda


Output


233

Note

In the first example we can generate S = { "asdf", "asd", "adf", "asf", "sdf" }. The cost of the first element in S is 0 and the cost of the others is 1. So the total cost of S is 4.
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  long long k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<vector<long long>> dp(n, vector<long long>(n));
  vector<vector<int>> a(n, vector<int>(27, -1));
  vector<bool> lets(27, 0);
  for (int i = 0; i < n; i++) {
    if (!lets[s[i] - 'a']) {
      lets[s[i] - 'a'] = 1;
      dp[i][i] = 1;
    }
  }
  for (int i = n - 2; i >= 0; i--) {
    for (int j = 0; j < 27; j++) {
      if (s[i + 1] == j + 'a') {
        a[i][j] = i + 1;
      } else {
        a[i][j] = a[i + 1][j];
      }
    }
  }
  for (int i = 0; i < n - 1; i++) {
    for (auto j : a[i]) {
      if (j == -1) continue;
      int d = j - i - 1;
      for (int x = 0; x + d < n; x++) {
        dp[j][x + d] += dp[i][x];
      }
    }
  }
  vector<long long> ans(n);
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      ans[i] += dp[j][j - i];
    }
  }
  long long anss = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (k <= ans[i]) {
      anss += k * (n - 1 - i);
      k = 0;
      break;
    } else {
      anss += ans[i] * (n - 1 - i);
      k -= ans[i];
      ans[i] = 0;
    }
  }
  if (k == 1) {
    k = 0;
    anss += n;
  }
  if (k != 0)
    cout << -1;
  else
    cout << anss;
  return 0;
}
