#include <bits/stdc++.h>
using namespace std;
char gc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
long long read() {
  char ch = getchar();
  long long x = 0;
  int op = 1;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') op = -1;
  for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + ch - '0';
  return x * op;
}
int n, k, a[55], ans;
char s[55];
int main() {
  n = read(), k = read();
  scanf("%s", s + 1);
  for (int i = (1); i <= (n); i++) a[i] = s[i] - 'a' + 1;
  sort(&a[1], &a[n + 1]);
  ans = 1000000001;
  for (int i = (1); i <= (n); i++) {
    int p = i, q, tmp = 0;
    bool flag = 1;
    for (int j = (1); j <= (k); j++) {
      if (p > n) {
        flag = 0;
        break;
      }
      tmp += a[p];
      q = p, p++;
      while (p <= n && abs(a[p] - a[q]) <= 1) p++;
    }
    if (flag) ans = min(ans, tmp);
  }
  if (ans == 1000000001)
    puts("-1");
  else
    printf("%d\n", ans);
  return 0;
}
