#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, cnt = 0;
  cin >> a >> b;
  string s;
  cin >> s;
  s += "%";
  for (long long i = 0; i < a; ++i)
    if (s[i] != s[i + 1]) cnt++;
  long long ans = cnt * (a * b - a);
  cnt = 0;
  for (long long i = 1; i < a; ++i) {
    if (s[i] != s[i - 1]) {
      if (i >= 2 && s[i - 2] == s[i])
        cnt++;
      else
        cnt = 2;
    } else
      cnt = 1;
    if (cnt) ans -= (cnt - 1);
  }
  cout << ans << endl;
  return 0;
}
