#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, w = 0, a, b;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    v.push_back((int)s[i] - 96);
  }
  sort(v.begin(), v.end());
  w = v[0];
  k = k - 1;
  int z = v[0];
  for (int i = 1; i < v.size(); i++) {
    if (k >= 1) {
      if (v[i] - z > 1) {
        k = k - 1;
        w = w + v[i];
        z = v[i];
      }
    } else {
      break;
    }
  }
  if (k == 0)
    cout << w;
  else {
    cout << -1;
  }
}
