#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500005;
char small[MAXN], large[MAXN];
int main(void) {
  int n;
  long long k;
  scanf("%d%I64d", &n, &k);
  scanf("%s", small);
  scanf("%s", large);
  long long cnt = 1;
  long long answer = 0;
  for (int i = 0; i < n; i++) {
    if (cnt < k) {
      cnt = (cnt - 1) * 2;
      if (small[i] == 'a') ++cnt;
      if (large[i] == 'b') ++cnt;
    }
    answer += min(cnt, k);
  }
  printf("%I64d\n", answer);
  return 0;
}
