#include <bits/stdc++.h>
using namespace std;
char str[51];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  cin >> str;
  sort(str, str + n);
  int k = 0;
  int fir = -2;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (k == m) break;
    if (str[i] - 'a' >= fir + 2) {
      ans += str[i] - 'a' + 1;
      fir = str[i] - 'a';
      k++;
    }
  }
  if (k < m) {
    puts("-1");
  } else {
    printf("%d\n", ans);
  }
}
