#include <bits/stdc++.h>
using namespace std;
char u[500009], d[500009];
long long f[500009], ct[500009];
long long n, k;
void dfs(int p, bool up, bool down) {
  if (p > n) return;
  if (!up && !down)
    if (u[p] == d[p])
      ct[p] = 1, dfs(p + 1, 0, 0);
    else
      ct[p] = 2, dfs(p + 1, 0, 1), dfs(p + 1, 1, 0);
  else if (up && !down)
    if (d[p] == 'a')
      f[p]++, ct[p]++, dfs(p + 1, up, down);
    else
      ct[p]++, dfs(p + 1, up, down);
  else if (!up && down)
    if (u[p] == 'b')
      f[p]++, ct[p]++, dfs(p + 1, up, down);
    else
      ct[p]++, dfs(p + 1, up, down);
  else
    ;
}
int main() {
  scanf("%lld%lld", &n, &k);
  scanf("%s%s", d + 1, u + 1);
  dfs(1, 0, 0);
  long long now = 0;
  long long use = 0;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    now <<= 1;
    now += f[i];
    long long cnt = now - use + ct[i];
    ans += min(cnt, k) * (n - i + 1);
    k -= cnt;
    if (k <= 0) break;
    use += cnt;
  }
  printf("%lld\n", ans);
}
