#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int i, t = 0, n, k, c = 0;
  string s;
  char p;
  cin >> n >> k;
  cin >> s;
  if (k > n) {
    cout << -1 << endl;
    return 0;
  }
  sort(s.begin(), s.end());
  t = s[0] - 'a' + 1;
  p = s[0];
  c = 1;
  for (i = 1; i < n && c != k; i++) {
    if (s[i] - p >= 2) {
      c++;
      t = t + (s[i] - 'a' + 1);
      p = s[i];
    }
  }
  if (c == k)
    cout << t << endl;
  else
    cout << -1 << endl;
}
