#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int ans = 1e9;
  int cnt = 1, w, pre;
  sort(s.begin(), s.end());
  w = s[0] - 'a' + 1;
  pre = s[0];
  for (int i = 1; i < n; i++) {
    if (cnt == k) break;
    if (s[i] - pre >= 2) {
      cnt++;
      pre = s[i];
      w += s[i] - 'a' + 1;
    }
  }
  if (cnt == k)
    cout << w;
  else
    cout << -1;
  return 0;
}
