#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, m, same;
string s;
int main() {
  cin >> n >> m >> s;
  long long ans = 1LL * n * (m - 1);
  for (int i = 1; i < n; i++) {
    if (s[i] == s[i - 2]) {
      same++;
    } else {
      same = 0;
    }
    if (s[i] != s[i - 1]) {
      ans += 1LL * n * (m - 1) - same - 1;
    }
  }
  cout << ans << endl;
  return 0;
}
