#include <bits/stdc++.h>
using namespace std;
int cst[21][21];
int mem[2123456];
int n, m;
int dp(int msk) {
  if (msk == (1 << m) - 1) return 0;
  if (mem[msk] == -1) {
    int pos = 0;
    for (int i = 0; i < m; i++) pos += (((1 << i) & msk) != 0);
    int mn = 20 * 112345;
    for (int i = 0; i < m; i++) {
      if (((1 << i) & msk) == 0) {
        int x = 0;
        for (int j = 0; j < m; j++) {
          if (j == i) continue;
          if (((1 << j) & msk))
            x += cst[i][j] * pos;
          else
            x -= cst[i][j] * pos;
        }
        mn = min(mn, x + dp(msk | (1 << i)));
      }
    }
    mem[msk] = mn;
  }
  return mem[msk];
}
int main() {
  srand(345);
  char s[112345];
  memset(mem, -1, sizeof(mem));
  cin >> n >> m;
  vector<int> p, v(m);
  scanf(" %s", s);
  for (int i = 0; i < n - 1; i++) {
    int a = s[i] - 'a';
    int b = s[i + 1] - 'a';
    cst[a][b] = cst[b][a] = cst[a][b] + 1;
  }
  cout << dp(0) << endl;
}
