#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmin(T &x, T y) {
  return (y < x) ? (x = y, 1) : 0;
}
template <typename T>
inline bool chkmax(T &x, T y) {
  return (y > x) ? (x = y, 1) : 0;
}
inline int read() {
  int x;
  char c;
  int f = 1;
  while ((c = getchar()) != '-' && (c > '9' || c < '0'))
    ;
  if (c == '-') f = -1, c = getchar();
  x = c ^ '0';
  while ((c = getchar()) >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + (c ^ '0');
  return x * f;
}
inline long long readll() {
  long long x;
  char c;
  int f = 1;
  while ((c = getchar()) != '-' && (c > '9' || c < '0'))
    ;
  if (c == '-') f = -1, c = getchar();
  x = c ^ '0';
  while ((c = getchar()) >= '0' && c <= '9')
    x = (x << 1ll) + (x << 3ll) + (c ^ '0');
  return x * f;
}
const int maxn = 5e5 + 10;
char s[maxn], t[maxn];
int main() {
  int n = read(), k = read();
  scanf("%s%s", s + 1, t + 1);
  if (k == 1) return printf("%d\n", n), 0;
  long long ans = 0, u = 0, v = 0;
  bool flag = 1;
  for (register int i = 1, iend = n; i <= iend; ++i) {
    if (flag && s[i] == t[i]) {
      ++ans;
      continue;
    }
    flag = 0;
    u = u * 2 + t[i] - 'a', v = v * 2 + s[i] - 'a';
    if (u - v + 1 >= k) {
      ans += (long long)k * (n - i + 1);
      return printf("%lld\n", ans), 0;
    }
    ans += u - v + 1;
  }
  printf("%lld\n", ans);
  return 0;
}
