#include <bits/stdc++.h>
using namespace std;
const int inf = 0x7fffffff;
const double eps = 1e-10;
const double pi = acos(-1.0);
inline int read() {
  int x = 0, f = 1;
  char ch;
  ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = 0;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch & 15);
    ch = getchar();
  }
  if (f)
    return x;
  else
    return -x;
}
const int N = 5e5 + 10;
int n, k;
bool s[N], t[N];
char ch[N];
int main() {
  n = read();
  k = read();
  scanf("%s", ch);
  for (int i = 0; i < n; i++) s[i] = (ch[i] == 'b');
  scanf("%s", ch);
  for (int i = 0; i < n; i++) t[i] = (ch[i] == 'b');
  long long a = 2, ans = 0;
  for (int i = 0; i < n; i++, a <<= 1) {
    if (s[i]) a--;
    if (!t[i]) a--;
    if (a - 2ll * (n - i) > k) {
      ans += 1ll * (n - i) * k;
      break;
    }
    ans += min(a, 1ll * k);
  }
  printf("%I64d\n", ans);
  return 0;
}
