#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  char s[53];
  while (scanf("%d%d", &n, &k) != EOF) {
    scanf("%s", s);
    sort(s, s + n);
    int ans = 0, cnt = 0;
    char prev = s[0];
    for (int i = 0; i < n && cnt < k; i++) {
      if (i == 0) {
        ans += s[i] - 'a' + 1;
        cnt++;
        prev = s[i];
      } else if (s[i] > prev + 1) {
        ans += s[i] - 'a' + 1;
        cnt++;
        prev = s[i];
      }
    }
    printf("%d\n", cnt == k ? ans : -1);
  }
  return 0;
}
