#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, rep = 1, ans = 0;
  cin >> n >> k;
  string s, t;
  cin >> s >> t;
  for (long long i = 0; i < n; i++) {
    if (rep > k) {
      ans = ans + k;
      continue;
    }
    rep = rep * 2;
    if (s[i] == 'b') rep--;
    if (t[i] == 'a') rep--;
    ans = ans + min(rep, k);
  }
  cout << ans;
}
