#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int n, m;
char s[maxn];
int main() {
  while (scanf("%d%d%s", &n, &m, s) != EOF) {
    long long ans = n * m - n;
    for (int i = (1); i <= (n - 1); ++i) {
      if (s[i] != s[i - 1]) {
        ans += n * m - n;
      }
    }
    long long cnt = 1;
    for (int i = (1); i <= (n - 1); ++i) {
      if (cnt == 1) {
        if (s[i] != s[i - 1]) ++cnt;
      } else {
        if (s[i] == s[i - 2]) {
          ++cnt;
        } else {
          ans -= cnt * (cnt - 1) / 2;
          cnt = s[i] == s[i - 1] ? 1 : 2;
        }
      }
    }
    ans -= cnt * (cnt - 1) / 2;
    printf("%I64d\n", ans);
  }
  return 0;
}
