#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const int maxn = 5e6 + 10;
long long n, k;
char s[maxn], t[maxn];
void tr(char& c) {
  if (c == 'a')
    c = '0';
  else
    c = '1';
}
int main() {
  cin >> n >> k;
  scanf("%s%s", s + 1, t + 1);
  for (int tt = (1); tt < (n + 1); ++tt) {
    tr(s[tt]), tr(t[tt]);
  }
  long long ans = 0;
  long long ca = 0, cb = 0;
  bool over = 0;
  for (int dep = 1; dep <= n; ++dep) {
    if (!over) {
      ca = ca * 2 + s[dep] - '0';
      cb = cb * 2 + t[dep] - '0';
      long long cnt = cb - ca + 1;
      if (cnt > k) {
        over = 1;
        cnt = k;
      }
      ans += cnt;
    } else {
      ans += k;
    }
  }
  cout << ans;
}
