#include <bits/stdc++.h>   using namespace std;   int mp[28];   bool fl[28];   int main() {     int n, k;     cin >> n >> k;     string s;     cin >> s;     memset(mp, 0, sizeof(mp));     for (int i = 0; i < s.size(); i++) {       mp[s[i] -  a  + 1]++;     }     int cnt = 0;     int ans = 0;     for (int i = 1; i <= 26; i++) {       if (mp[i] != 0 && fl[i - 1] == 0) {         ans += i;         cnt++;         fl[i] = 1;       }       if (cnt >= k) break;     }     if (cnt == k)       cout << ans << endl;     else       cout <<  -1  << endl;   }   