#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  vector<char> s(n + 1), t(n + 1);
  scanf("%s", &s[0]);
  scanf("%s", &t[0]);
  long long ans = 0;
  long long cnt_a = 0;
  long long cnt_b = 0;
  bool found_diff = false;
  bool big_num = false;
  for (int i = 0; i < n; ++i) {
    if (found_diff && !big_num) {
      cnt_a = cnt_a * 2 + (s[i] == 'a' ? 1 : 0);
      cnt_b = cnt_b * 2 + (t[i] == 'b' ? 1 : 0);
    }
    if (s[i] != t[i]) {
      found_diff = true;
    }
    if (found_diff) {
      ans += min(cnt_a + cnt_b + 2, (long long)k);
      if (cnt_a + cnt_b + 2 >= k) {
        big_num = true;
      }
    } else {
      ++ans;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
