#include <bits/stdc++.h>
using namespace std;
int n, k;
string s;
bool visit[30];
int main() {
  cin >> n >> k;
  cin >> s;
  sort(s.begin(), s.end());
  char last = '0';
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (last == '0' || s[i] - last >= 2) {
      ans += s[i] - 'a' + 1;
      last = s[i];
      k--;
      if (k == 0) break;
    }
  }
  if (k == 0)
    printf("%d\n", ans);
  else
    printf("-1\n");
  return 0;
}
