#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  char s[51];
  for (int i = 0; i < n; i++) cin >> s[i];
  sort(s, s + n);
  int ans = s[0] - 96;
  int count = 1;
  int pre = 0;
  for (int i = 0; i < n; i++) {
    if (count == k) {
      break;
    }
    if (s[i] - s[pre] >= 2) {
      pre = i;
      count++;
      ans += s[i] - 96;
    }
  }
  if (count != k)
    cout << "-1" << endl;
  else
    cout << ans << endl;
  return 0;
}
