#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const int N = (int)1e6 + 7, mod = 1000000007, M = 2e9;
int n, k, c;
string s, t;
int main() {
  cin >> n >> k >> s;
  sort(s.begin(), s.end());
  t += s[0];
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (s[j] - s[i] > 1) {
        t += s[j], i = j - 1;
        break;
      }
    }
  }
  if (t.size() < k) return puts("-1");
  for (int i = 0; i < k; i++) c += t[i] - 'a' + 1;
  cout << c;
  return 0;
}
