#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  sort(s.begin(), s.end());
  int last = -10;
  int ans = 0;
  int j = 0;
  for (int i = 0; i < n && j < k; i++) {
    int temp = s[i] - 'a' + 1;
    if (temp - last > 1) {
      ans += temp;
      last = temp;
      j++;
    }
  }
  if (j < k) {
    cout << -1;
  } else {
    cout << ans;
  }
}
