#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  bool b[26] = {};
  cin >> n >> k;
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) {
    b[s[i] - 'a'] = 1;
  }
  int ans = 0;
  for (int i = 0; i < 26 && k > 0; i++) {
    if (b[i]) {
      i++;
      ans += i;
      k--;
    }
  }
  if (k > 0)
    cout << -1 << endl;
  else
    cout << ans << endl;
  return 0;
}
