#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e5 + 5;
long long n, k, a, b, ans;
char s[MAXN], t[MAXN];
int main() {
  cin >> n >> k;
  scanf("%s%s", s + 1, t + 1);
  for (int i = 1; i <= n; ++i) {
    a = a << 1 | (s[i] - 'a');
    b = b << 1 | (t[i] - 'a');
    if (b - a >= k) {
      ans += (n - i + 1) * k;
      break;
    }
    ans += (b - a + 1);
  }
  cout << ans << endl;
  return 0;
}
