#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 1912;
long long n, m;
string s;
int a[maxn];
void ReadData() {
  cin >> n >> m;
  m--;
  cin >> s;
}
void Process() {
  int p = 0;
  long long c = 0;
  for (int _a = 1, _b = n - 1, i = _a; i <= _b; i++) {
    if (s[i] == s[i - 1]) {
      c += n * m;
      p = i;
    } else if (i >= 2 && s[i] != s[i - 2])
      p = i - 1;
    c += i - p;
  }
  cout << n * n * m - c;
}
int main() {
  std ::ios_base::sync_with_stdio(false);
  cin.tie(0);
  ReadData();
  Process();
  return 0;
}
