#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, t = 0;
  cin >> n >> k;
  string s;
  cin >> s;
  sort((s).begin(), (s).end());
  t = (int)s[0] - 'a' + 1;
  int i = 1, j = 0, q = 1, f = 0;
  while (i < n) {
    if (s[i] - s[j] >= 2 && i < n) {
      if (q == k) {
        f = 1;
        break;
      }
      t += s[i] - 'a' + 1;
      j = i;
      q++;
      if (q == k) {
        f = 1;
        break;
      }
    }
    i++;
  }
  if (f == 0 && k != 1)
    cout << -1 << endl;
  else
    cout << t << endl;
  return 0;
}
