#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  if (k > 13) {
    cout << -1;
    return 0;
  }
  int a[26] = {0};
  for (int i = 0; i < s.length(); i++) a[s[i] - 'a']++;
  int len = 0, ans = 0;
  for (int i = 0; i < 26; i++) {
    if (a[i] == 0) continue;
    ans += i + 1;
    len++;
    if (len == k) break;
    i++;
  }
  if (len == k)
    cout << ans;
  else
    cout << -1;
  return 0;
}
