#include <bits/stdc++.h>
using namespace std;
const int N = 55;
char s[N];
int main() {
  int n, k;
  cin >> n >> k;
  cin >> s + 1;
  sort(s + 1, s + 1 + n);
  std::vector<char> v;
  for (int i = 1; i <= n; i++) {
    v.push_back(s[i]);
  }
  sort(v.begin(), v.end());
  v.resize(distance(v.begin(), unique(v.begin(), v.end())));
  ;
  int curr = 0, ret = 0, last = -2;
  for (int i = 0; i < v.size(); i++) {
    if (v[i] > last + 1) {
      curr++;
      ret += v[i] - 'a' + 1;
      last = v[i];
    }
    if (curr == k) break;
  }
  if (curr != k) {
    cout << -1;
    return 0;
  }
  cout << ret;
  return 0;
}
