#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  string s, t;
  cin >> n >> k >> s >> t;
  long long changes = 0, current_changes;
  long long lo = 0, hi = 0;
  for (int i = 0; i < n; i++) {
    lo <<= 1;
    hi <<= 1;
    lo += (s[i] - 'a');
    hi += (t[i] - 'a');
    current_changes = hi - lo + 1;
    if (current_changes > k) current_changes = k;
    changes += current_changes;
    if (current_changes == k) {
      changes += (n - i - 1) * k;
      break;
    }
  }
  std::cout << changes << '\n';
}
