#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, k;
  string s;
  cin >> n >> k;
  cin >> s;
  sort(s.begin(), s.end());
  ;
  int ans = 0;
  int c = 1;
  char l = s[0];
  ans = s[0] - 'a' + 1;
  for (int i = 1; i < n; i++) {
    if (c == k) {
      break;
    }
    if (s[i] - l >= 2) {
      c++;
      ans += s[i] - 'a' + 1;
      l = s[i];
    }
  }
  if (c == k) {
    cout << ans << "\n";
  } else {
    cout << "-1\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  t = 1;
  for (int I = 1; I <= t; I++) {
    solve();
  }
  return 0;
}
