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