#include <bits/stdc++.h>
using namespace std;
const int N = 102;
const long long INF = 1e18;
int n;
string s;
long long k, f[26][N], g[N];
void add(long long &x, long long y) {
  x += y;
  if (x > INF) x = INF;
}
long long tmpF[N];
void update(char ch) {
  int x = ch - 'a';
  memset(tmpF, 0, sizeof(tmpF));
  tmpF[1] = 1;
  for (int c = 0; c <= 25; c++)
    for (int i = 2; i <= n; i++) add(tmpF[i], f[c][i - 1]);
  for (int i = 1; i <= n; i++) f[x][i] = tmpF[i];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  cin >> s;
  for (char ch : s) update(ch);
  g[0] = 1;
  for (int c = 0; c <= 25; c++)
    for (int i = 1; i <= n; i++) add(g[i], f[c][i]);
  long long res = 0;
  for (int i = n; i >= 0; i--) {
    long long tmp = min(k, g[i]);
    k -= tmp;
    res += tmp * (n - i);
  }
  cout << (k == 0 ? res : -1);
  return 0;
}
