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