#include <bits/stdc++.h>
using namespace std;
signed long long N, M;
signed long long ret;
string S;
void solve() {
  int i, j, k, l, r, x, y;
  string s;
  cin >> N >> M;
  cin >> S;
  ret += N * (M - 1);
  for (x = 0; x < N - 1; x++)
    if (S[x] != S[x + 1]) ret += N * (M - 1);
  int cur = 0;
  for (x = 1; x < N; x++) {
    if (S[x - 1] == S[x]) {
      cur = 0;
    } else {
      if (x > 1 && S[x] != S[x - 2]) cur = 0;
      cur++;
    }
    ret -= cur;
  }
  cout << ret << endl;
}
int main(int argc, char** argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false);
  for (i = 0; i < argc - 1; i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < s.size(); i++) ungetc(s[s.size() - 1 - i], stdin);
  solve();
  return 0;
}
