#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int a[26];
  int cnt = 1;
  for (int i = 0; i < 26; i++) {
    a[i] = 0;
  }
  map<char, int> mp;
  string s;
  cin >> s;
  long sum = 0;
  sort(s.begin(), s.end());
  for (int i = 0; i < s.length(); i++) {
    if (k <= 0) break;
    if (mp[s[i] - 1]) continue;
    if (mp[s[i]]) continue;
    sum += s[i] - 'a' + 1;
    k--;
    mp[s[i]]++;
  }
  if (k <= 0)
    cout << sum;
  else
    cout << -1;
  return 0;
}
