#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k;
  cin >> n >> k;
  string A, B;
  cin >> A >> B;
  long long ret = 0;
  long long ways = 1;
  bool isinf = false;
  for (auto i = (0); i != (n); ++i) {
    if (!isinf) {
      ways *= 2;
      if (B[i] == 'a') ways--;
      if (A[i] == 'b') ways--;
    }
    isinf |= ways > 1e11;
    ret += isinf ? k : min(ways, k);
  }
  cout << ret << endl;
  return 0;
}
