#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, n, k, ans = 0, count = 0;
  int alpha[26];
  string s;
  cin >> n >> k;
  cin >> s;
  for (i = 0; i < 26; i++) alpha[i] = 0;
  for (i = 0; i < n; i++) alpha[s[i] - 97]++;
  for (i = 0; (i < 26) && (count < k); i++) {
    if (alpha[i] != 0) {
      ans = ans + i + 1;
      i++;
      count++;
    }
  }
  if (count < k)
    cout << -1 << endl;
  else
    cout << ans << endl;
  return 0;
}
