#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int maxn = 5e5 + 5;
char a[maxn], b[maxn];
int main() {
  int n;
  ll k;
  scanf("%d%lld", &n, &k);
  scanf("%s", a);
  scanf("%s", b);
  ll ans = 0, now = 1;
  if (k == 1) {
    printf("%d\n", n);
    return 0;
  }
  for (int i = 0; i < n; i++) {
    now *= 2;
    if (a[i] != 'a') now--;
    if (b[i] != 'b') now--;
    now = min(now, k);
    ans += now;
  }
  printf("%lld\n", ans);
}
