#include <bits/stdc++.h>
using namespace std;
int n, K, sz, ans, last;
string s;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> K >> s;
  sort(s.begin(), s.end());
  for (int i = 0; i < n && sz < K; ++i) {
    if (s[i] - last > 1) {
      ans += s[i] - 'a' + 1;
      last = s[i];
      sz++;
    }
  }
  cout << (sz == K ? ans : -1) << "\n";
}
