#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e5 + 5;
char v[MAXN], v2[MAXN];
long long cnt[MAXN];
long long x, total, respf;
int n;
int main() {
  scanf("%d %lld", &n, &x);
  scanf(" %s", v);
  scanf(" %s", v2);
  total = cnt[0] = 1 + (v[0] != v2[0]);
  for (int i = 1; i < n; i++) {
    cnt[i] = total;
    if (v[i] == 'b') cnt[i]--;
    if (v2[i] == 'a') cnt[i]--;
    total += cnt[i];
  }
  for (int i = 0; i < n && x > 0; i++) {
    if (x >= cnt[i])
      respf += cnt[i] * (n - i), x -= cnt[i];
    else
      respf += x * (n - i), x = 0;
  }
  printf("%lld\n", respf);
}
