#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, m, pos, tem, cnt;
  cin >> n >> k;
  string s;
  cin >> s;
  m = INT_MAX;
  sort(s.begin(), s.end());
  int arr[n];
  for (int i = 0; i < n; i++) {
    arr[i] = s[i] - 96;
  }
  cnt = arr[0];
  pos = 0;
  tem = k - 1;
  for (int i = 1; i < n; i++) {
    if ((arr[i] - arr[pos]) >= 2 && tem > 0) {
      cnt = cnt + arr[i];
      pos = i;
      tem--;
    }
  }
  if (tem == 0)
    cout << cnt << "\n";
  else
    cout << "-1\n";
}
