#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int d[100000];
  for (int i = 0; i < s.size(); i++) {
    d[i] = s[i] - 'a' + 1;
  }
  sort(d, d + n);
  int used = 1;
  int ans = d[0];
  int last = d[0];
  for (int i = 1; i <= n; i++) {
    if (used == k) break;
    if (d[i] >= (last + 2)) {
      used++;
      ans += d[i];
      last = d[i];
    }
  }
  if (used != k)
    printf("-1");
  else
    printf("%d", ans);
}
