#include <bits/stdc++.h>
long long N, K;
std::string S, T;
void Citire() { std::cin >> N >> K >> S >> T; }
void Rezolvare() {
  long long len = -1;
  while (len + 1 < N && S[len + 1] == T[len + 1]) ++len;
  if (K == 1) {
    std::cout << N << '\n';
    return;
  }
  K -= 2;
  long long Ans = 2 * N - len - 1;
  for (long long i = len + 2, sons, leaves = 0; i < N; ++i) {
    sons = 2;
    if (S[i] == 'b') --sons;
    if (T[i] == 'a') --sons;
    leaves += sons;
    if (K >= leaves)
      Ans += leaves * (N - i), K -= leaves;
    else
      Ans += K * (N - i), i = N;
    leaves -= sons;
    leaves *= 2;
    leaves += sons;
  }
  std::cout << Ans << '\n';
}
int main() {
  Citire();
  Rezolvare();
  return 0;
}
