#include <bits/stdc++.h>
using namespace std;
long long n, m;
char a[500005], b[500005];
int main() {
  scanf("%lld%lld", &n, &m);
  scanf("%s%s", a + 1, b + 1);
  long long sum = -1, k = 1, ans = 0;
  while (k <= n && a[k] == b[k]) k++, ans++;
  for (long long i = k; i <= n; i++) {
    sum = sum * 2 + 'b' - a[i] + b[i] - 'a';
    if (sum + 2 >= m) {
      ans += (n - i + 1) * m;
      break;
    } else
      ans += sum + 2;
  }
  printf("%lld\n", ans);
  return 0;
}
