#include <bits/stdc++.h>
using namespace std;
char s[100];
int n, k, cnt = 0, ans = 0;
set<int> S;
int last = -0x3f3f3f3f;
int main() {
  scanf("%d %d", &n, &k);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++) S.insert(s[i] - 'a' + 1);
  for (auto it = S.begin(); it != S.end(); it++) {
    if (cnt == k) break;
    if ((*it) > last + 1) {
      ans += (*it);
      cnt++;
      last = (*it);
    }
  }
  if (cnt != k)
    printf("-1");
  else
    printf("%d", ans);
  return 0;
}
