#include <bits/stdc++.h>
using namespace std;
char a[55];
int s[55], vis[110];
int main() {
  int n, m, i, j, k, ans;
  scanf("%d%d", &n, &m);
  scanf("%s", a);
  for (i = 0; i < n; i++) {
    j = a[i] - 'a' + 1;
    s[i] = j;
  }
  sort(s, s + n);
  k = 0;
  ans = 0;
  for (i = 0; i < n && k < m; i++) {
    if (vis[s[i]]) continue;
    k++;
    ans = ans + s[i];
    vis[s[i]] = 1;
    ;
    vis[s[i] + 1] = 1;
  }
  if (k == m)
    printf("%d\n", ans);
  else
    printf("-1\n");
  return 0;
}
