#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, j, k, l;
  string s;
  cin >> n >> m >> s;
  int i;
  vector<int> ve;
  for (i = 0; s[i] != 0; i++) {
    l = (int)s[i] - 'a' + 1;
    ve.push_back(l);
  }
  sort(ve.begin(), ve.end());
  k = ve[0];
  int sum = k;
  j = 1;
  for (i = 1; i < n && j != m; i++) {
    if (ve[i] - k >= 2) {
      j++;
      sum = sum + ve[i];
      k = ve[i];
    }
  }
  if (j != m) {
    cout << "-1" << endl;
    return 0;
  }
  cout << sum << endl;
  return 0;
}
