#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  char ch;
  int a[n + 5];
  for (int i = 0; i < n; i++) {
    cin >> ch;
    a[i] = ch - 'a' + 1;
  }
  int ans = 0;
  sort(a, a + n);
  ans += a[0];
  int l = 0;
  k--;
  for (int i = 1; i < n && k; i++) {
    if (a[i] - a[l] >= 2) ans += a[i], l = i, k--;
  }
  if (k == 0)
    cout << ans << endl;
  else
    cout << "-1" << endl;
  return 0;
}
