#include <bits/stdc++.h>
using namespace std;
char stage[600];
char letra_usada[10000];
int peso;
int usado[600];
int n;
int k;
int main() {
  cin >> n;
  cin >> k;
  int i;
  for (i = 1; i <= n; i++) {
    cin >> stage[i];
  }
  sort(stage + 1, stage + 1 + n);
  i = 1;
  int cont = 0;
  peso = 0;
  char ultima = 'a' - 3;
  for (i = 1; i <= n; i++) {
    if (stage[i] > ultima + 1) {
      ultima = stage[i];
      peso += stage[i] - 'a' + 1;
      cont++;
    }
    if (cont == k) break;
  }
  if (cont != k)
    cout << -1 << endl;
  else
    cout << peso << endl;
}
