#include <bits/stdc++.h>
using namespace std;
char a[51];
int main() {
  int n, k, sum = 0, cnt = 0, i;
  char last;
  scanf("%d%d", &n, &k);
  for (i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  for (i = 1; i <= n; i++) {
    if (i == 1 || a[i] - last > 1) {
      if (cnt < k) {
        sum += a[i] - 'a' + 1;
        last = a[i];
        cnt++;
      }
    }
  }
  if (cnt >= k)
    printf("%d", sum);
  else
    printf("-1");
  return 0;
}
