#include <bits/stdc++.h>
using namespace std;
int cho[30];
char str[1005];
int main() {
  int a, b, ans = 0;
  cin >> a >> b;
  for (int i = 0; i < a; i++) {
    cin >> str[i];
    cho[str[i] - 96]++;
  }
  int tot = b;
  for (int i = 1; i <= 26; i++) {
    if (tot == 0) {
      break;
    } else if (tot != 0 && cho[i] >= 1) {
      if (cho[i - 1] != -1) {
        ans += i;
        tot--;
        cho[i] = -1;
      }
    }
  }
  if (tot == 0)
    cout << ans << endl;
  else if (tot > 0)
    cout << -1 << endl;
  return 0;
}
