#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-5;
const long double PI = acos(-1);
const int INF = (int)1e9;
const long long INFF = (long long)1e18;
const int mod = (int)1e9 + 7;
const int MXN = (int)5e5 + 7;
int n, k;
char s1[MXN], s2[MXN];
int a[MXN], b[MXN];
struct data {
  int p, siz, v1, v2;
  data(){};
  data(int _p, int _siz, int _v1, int _v2) {
    p = _p, siz = _siz, v1 = _v1, v2 = _v2;
  }
};
long long sum = 0;
long long cnt[MXN];
long long sub;
inline void check(int siz) {
  if (siz >= k) {
    sum += k;
    for (int i = 0; i < MXN; ++i)
      if (cnt[i]) {
        if (cnt[i] >= sub) {
          sum += (n - i) * sub;
          break;
        } else
          sum += (n - i) * cnt[i];
        sub -= cnt[i];
      }
    printf("%lld\n", sum);
    exit(0);
  }
  k -= siz;
  sum += siz;
  return;
}
int main(void) {
  scanf("%d %d %s %s", &n, &k, s1 + 1, s2 + 1);
  sub = k;
  for (int i = 1; i < n + 1; ++i) {
    if (s1[i] == 'b') a[i] = 1;
    if (s2[i] == 'b') b[i] = 1;
  }
  if (k == 1) {
    printf("%d\n", n);
    return 0;
  }
  k--;
  queue<data> Q;
  Q.push(data(0, 1, 0, 0));
  cnt[0] = 1;
  while (!Q.empty()) {
    data cc = Q.front();
    Q.pop();
    int p = cc.p, siz = cc.siz, v1 = cc.v1, v2 = cc.v2;
    if (p == n) continue;
    p++;
    sum += siz;
    if (!v1 && !v2) {
      if (!a[p] && b[p]) {
        Q.push(data(p, siz, 1, 0));
        Q.push(data(p, siz, 0, 1));
        cnt[p - 1] -= siz;
        cnt[p] += 2 * siz;
        check(siz);
      } else {
        Q.push(data(p, siz, 0, 0));
        cnt[p - 1] -= siz;
        cnt[p] += siz;
      }
    } else if (!v1) {
      if (a[p]) {
        Q.push(data(p, siz, 0, 1));
        cnt[p - 1] -= siz;
        cnt[p] += siz;
      } else {
        Q.push(data(p, siz, 0, 1));
        Q.push(data(p, siz, 1, 1));
        cnt[p - 1] -= siz;
        cnt[p] += siz;
        cnt[p] += siz;
        check(siz);
      }
    } else if (!v2) {
      if (!b[p]) {
        Q.push(data(p, siz, 1, 0));
        cnt[p - 1] -= siz;
        cnt[p] += siz;
      } else {
        Q.push(data(p, siz, 1, 0));
        Q.push(data(p, siz, 1, 1));
        cnt[p - 1] -= siz;
        cnt[p] += siz;
        cnt[p] += siz;
        check(siz);
      }
    } else {
      Q.push(data(p, siz * 2, 1, 1));
      cnt[p - 1] -= siz;
      cnt[p] += siz;
      cnt[p] += siz;
      check(siz);
    }
  }
  for (int i = 0; i < MXN; ++i) {
    if (cnt[i] >= sub) {
      sum += (n - i) * sub;
      break;
    } else
      sum += (n - i) * cnt[i];
    sub -= cnt[i];
  }
  printf("%lld\n", sum);
  return 0;
}
