#include <bits/stdc++.h>
using namespace std;
const int maxn = int(1e6) + 10;
int main() {
  int n, m;
  char str[maxn];
  while (~scanf("%d %d", &n, &m)) {
    scanf("%s", str);
    sort(str, str + n);
    int i = 1;
    int top = 1;
    int tmp = str[0];
    int ans = str[0] - 'a' + 1;
    while (i < n) {
      if (top == m) break;
      if (str[i] - tmp >= 2) {
        ans += str[i] - 'a' + 1;
        tmp = str[i];
        top++;
      }
      i++;
    }
    if (top < m)
      printf("-1\n");
    else
      printf("%d\n", ans);
  }
  return 0;
}
