#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
bool have[26];
int memo[51][51];
int solve(int n, int k) {
  if (n < 0 && k > 0) {
    return 1e9;
  }
  if (k == 0) return 0;
  if (memo[n][k]) return memo[n][k];
  int x = 1e9, y = 1e9;
  if (have[n]) {
    x = solve(n - 2, k - 1) + (n + 1);
  }
  y = solve(n - 1, k);
  int ans = min(x, y);
  memo[n][k] = ans;
  return ans;
}
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  for (int i = 0; i < n; ++i) {
    have[s[i] - 'a'] = true;
  }
  int ans = solve(25, k);
  if (ans >= 1e9)
    cout << "-1";
  else
    cout << ans;
  return 0;
}
