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;
const long double pi = 2 * acos(0.0);
long long infinity = std::numeric_limits<long long>::max();
const long long mod = 1000000007;
const long long MAXN = 1;
const long long max_INT = 2000000;
long long binary_search(long long dp[], long long n, long long p) {
  long long l, r, mid;
  l = 0;
  r = n - 1;
  while (l <= r && l >= 0 && l <= n - 1 && r >= 0 && r <= n - 1) {
    mid = (l + r) / 2;
    if (dp[mid] >= p) {
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  return l;
}
int extended_euclid(int a, int b, int &x, int &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  int x1, y1, g;
  g = extended_euclid(b, a % b, x1, y1);
  x = y1;
  y = x1 - y1 * (a / b);
  return g;
}
bool linear_diaphantine(int a, int b, int c, int &x, int &y, int &g) {
  int x1, y1;
  g = extended_euclid(abs(a), abs(b), x1, y1);
  if (c % g) {
    return false;
  }
  x = (c / g) * x1;
  y = (c / g) * y1;
  if (a < 0) x = -x;
  if (b < 0) y = -y;
  return true;
}
int spf[MAXN];
void sieve() {
  spf[1] = 1;
  for (int i = 2; i < MAXN; i++) {
    spf[i] = i;
  }
  for (int i = 4; i < MAXN; i += 2) spf[i] = 2;
  for (int i = 3; i * i < MAXN; i++) {
    if (spf[i] == i) {
      for (int j = i * i; j < MAXN; j += i) {
        if (spf[j] == j) {
          spf[j] = i;
        }
      }
    }
  }
}
bool prime[MAXN];
void SieveOfEratosthenes(long long n = MAXN - 1) {
  memset(prime, true, sizeof(prime));
  prime[1] = false;
  for (long long p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (long long i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
}
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long constructSTUtil(long long arr[], long long ss, long long se,
                          long long *st, long long si) {
  if (ss == se) {
    st[si] = arr[ss];
    return arr[ss];
  }
  long long mid = ss + (se - ss) / 2;
  st[si] = min(constructSTUtil(arr, ss, mid, st, si * 2 + 1),
               constructSTUtil(arr, mid + 1, se, st, si * 2 + 2));
  return st[si];
}
long long *constructST(long long arr[], long long n) {
  long long x = (long long)(ceil(log2(n)));
  long long max_size = 2 * (long long)pow(2, x) - 1;
  long long *st = new long long[max_size];
  constructSTUtil(arr, 0, n - 1, st, 0);
  return st;
}
long long RMQ(long long *st, long long ss, long long se, long long qs,
              long long qe, long long index) {
  if (qs <= ss && qe >= se) return st[index];
  if (se < qs || ss > qe) return INT_MAX;
  long long mid = ss + (se - ss) / 2;
  return min(RMQ(st, ss, mid, qs, qe, 2 * index + 1),
             RMQ(st, mid + 1, se, qs, qe, 2 * index + 2));
}
struct trap {
  long long l, r, d;
};
long long reversDigits(long long num) {
  long long rev_num = 0;
  while (num > 0) {
    rev_num = rev_num * 10 + num % 10;
    num = num / 10;
  }
  return rev_num;
}
long long findSmallest(long long m, long long s) {
  if (s == 0) {
    if (m == 1)
      return (0);
    else
      return (-1);
  }
  if (s > 9 * m) {
    return (-1);
  }
  int res[m];
  s -= 1;
  for (int i = m - 1; i > 0; i--) {
    if (s > 8) {
      res[i] = 9;
      s -= 9;
    } else {
      res[i] = s;
      s = 0;
    }
  }
  res[0] = s + 1;
  long long num = 0;
  long long flag = 0;
  if (res[m - 1] == 9) {
    flag = 1;
    res[m - 1]--;
    long long i = m - 2;
    while (i >= 0) {
      if (res[i] < 9) {
        flag = 0;
        res[i]++;
        break;
      }
      --i;
    }
  }
  if (flag == 1) {
    return (-1);
  }
  for (int i = m - 1; i >= 0 && flag == 0; --i) {
    num += res[i];
    if (i != 0) num *= 10;
  }
  return (reversDigits(num));
}
struct nums {
  long long val, index, orig, team_num;
};
bool compare(nums n1, nums n2) { return (n1.val < n2.val); }
bool compare1(nums n1, nums n2) { return (n1.orig < n2.orig); }
long long numbers(long long open, long long close, string s) {
  string s1;
  long long i, count = 0, ans = 0, n, x = 0, first = 700, last = -1, num, c;
  stack<char> s2;
  stack<long long> s3;
  s1 = s;
  swap(s1[open], s1[close]);
  n = s1.size();
  for (i = 0; i < s1.size(); ++i) {
    if (s1[i] == ')') {
      if (s2.size() == 0) {
        count = 0;
        first = 700, last = -1;
        x = 1;
      } else {
        s2.pop();
        if (s2.size() == 0) {
          first = min(first, s3.top());
          ++count;
          last = max(last, i);
        }
        s3.pop();
      }
    } else {
      s2.push(s1[i]);
      s3.push(i);
    }
  }
  stack<long long> s4;
  string s5 = "";
  if (first == 0 && last == n - 1)
    return (count);
  else if (first == 700 && last == -1)
    return (0);
  else {
    num = n - (last + 1) + (first);
    if (num == 0)
      return (count);
    else {
      i = (last + 1) % n;
      for (c = 0; c < num; ++c) {
        if (s1[i] == ')') {
          if (s4.size() == 0) {
            s4.push(s1[i]);
          } else {
            if (s4.top() == '(')
              s4.pop();
            else
              s4.push(s1[i]);
          }
        } else
          s4.push(s1[i]);
        s5 += s1[i];
        i++;
        i %= n;
      }
      if (s4.size() == 0) {
        return (count + 1);
      } else
        return (0);
    }
  }
}
int main() {
  long long n, k, i, j;
  cin >> n >> k;
  string s;
  cin >> s;
  long long dp[n + 1][n + 1], dpsum[n + 1], sum = 0, sum1 = 0;
  long long aux[26];
  for (i = 0; i <= n; ++i)
    for (j = 0; j <= n; ++j) dp[i][j] = 0;
  for (i = 0; i < 26; ++i) aux[i] = 0;
  for (i = 0; i < n; ++i) {
    dp[1][i] = 1 - aux[s[i] - 'a'];
    aux[s[i] - 'a'] += dp[1][i];
    sum += dp[1][i];
  }
  dpsum[1] = sum;
  for (i = 2; i <= n; ++i) {
    sum = 0;
    sum1 = 0;
    for (j = 0; j < 26; ++j) aux[j] = 0;
    for (j = 0; j < i - 1; ++j) sum += dp[i - 1][j];
    for (j = i - 1; j < n; ++j) {
      dp[i][j] = sum - aux[s[j] - 'a'];
      aux[s[j] - 'a'] += dp[i][j];
      sum1 += dp[i][j];
      sum += dp[i - 1][j];
    }
    dpsum[i] = sum1;
  }
  sum = 0;
  long long c = 0, ans = 0;
  for (i = n; i >= 1 && sum < k; --i) {
    if (sum + dpsum[i] < k) {
      sum += dpsum[i];
      ans += dpsum[i] * c;
      ++c;
    } else {
      ans += (k - sum) * c;
      sum += (k - sum);
      c++;
    }
  }
  if (sum != k) {
    if (k - sum == 1) {
      ans += c;
      cout << ans << "\n";
      return 0;
    } else {
      cout << -1 << "\n";
      return 0;
    }
  }
  cout << ans << "\n";
  return 0;
}
