#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 10;
inline char gc() {
  return getchar();
  static const int maxs = 1 << 16;
  static char buf[maxs], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, maxs, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline long long rd() {
  long long x = 0;
  char c = gc();
  bool neg = 0;
  while (c < '0' || c > '9') {
    if (c == '-') neg = 1;
    c = gc();
  }
  while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + c - '0', c = gc();
  return neg ? (~x + 1) : x;
}
long long N, K;
char l[maxn], r[maxn];
long long deled, pre, sumcnt, ans;
int main() {
  int i, j, k;
  N = rd(), K = rd();
  scanf("%s", l + 1);
  scanf("%s", r + 1);
  long long now = 1;
  for (i = 1; i <= N; i++) {
    now <<= 1;
    if (l[i] == 'b') now--;
    if (r[i] == 'a') now--;
    ans += min(now - pre, K - sumcnt) * (N - i + 1);
    sumcnt += now - pre;
    if (sumcnt >= K) break;
    pre = now;
  }
  printf("%I64d\n", ans);
  return 0;
}
