#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 10;
int n, k;
char s[N], t[N];
int updBase2[N], upd[N];
long long a[N];
long long ans;
int main() {
  scanf("%d %d\n", &n, &k);
  scanf("%s\n", &s);
  scanf("%s\n", &t);
  if (strcmp(s, t) == 0 || k == 1) {
    printf("%d\n", n);
    return 0;
  }
  {
    int i = 0;
    while (i < n && s[i] == t[i]) ++i;
    ans += i;
    k -= 2;
    n = (int)strlen(s + i);
    strcpy(s, s + i);
    strcpy(t, t + i);
  }
  ans += 2;
  for (int i = 1; i < n; ++i) {
    if (s[i] == 'a') {
      int h = n - i;
      upd[h] += 1;
      if (h - 1 > 0) {
        updBase2[h - 1] += 1;
      }
    }
    ans++;
    if (t[i] == 'b') {
      int h = n - i;
      upd[h] += 1;
      if (h - 1 > 0) {
        updBase2[h - 1] += 1;
      }
    }
    ans++;
  }
  for (int i = n; i >= 1; i--) {
    updBase2[i] += 2 * updBase2[i + 1];
    if (updBase2[i] > k) updBase2[i] = k;
    a[i] = upd[i] + updBase2[i];
  }
  for (int i = n; i >= 1; --i) {
    if (k >= a[i]) {
      ans += a[i] * i;
      k -= a[i];
    } else {
      ans += (long long)k * i;
      break;
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
