#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, k;
  cin >> n >> k;
  string s1, s2;
  cin >> s1 >> s2;
  long long int l = 0, r = 0, ans = 0, j = 0;
  for (int i = 0; i < n; i++) {
    l = l << 1 | s1[i] - 'a';
    r = r << 1 | s2[i] - 'a';
    if (r - l + 1 > k) break;
    ans += min((r - l + 1), k);
    j++;
  }
  cout << ans + k * (n - j) << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  t = 1;
  while (t--) {
    solve();
  }
}
