#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("-O2")
template <class T>
using min_heap = priority_queue<T, std::vector<T>, std::greater<T>>;
const int LM = 5e5;
long long n, k;
long long ans = 0;
string s, t;
int a[LM + 2], b[LM + 2];
int main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin >> n >> k >> s >> t;
  for (int i = 0; i <= n - 1; i++) {
    a[i + 1] = s[i] - 'a';
    b[i + 1] = t[i] - 'a';
  }
  ans += 2 * n;
  int ps = n + 1;
  for (int i = 1; i <= n; i++) {
    if (b[i] != a[i]) {
      ps = i + 1;
      break;
    }
    if (b[i] == a[i]) ans--;
  }
  if (k == 1) {
    cout << n << endl;
    return 0;
  }
  k -= 2;
  priority_queue<pair<long long, pair<long long, long long>>> pq;
  for (int i = ps; i <= n; i++) {
    if (a[i] == 0) {
      pq.push({n - i + 1, {n - i + 1, 1}});
    }
  }
  for (int i = ps; i <= n; i++) {
    if (b[i] == 1) {
      pq.push({n - i + 1, {n - i + 1, 1}});
    }
  }
  long long cn = 0;
  while (!pq.empty()) {
    auto a = pq.top();
    pq.pop();
    ans += a.first * (min(k - cn, a.second.second));
    cn += min(k - cn, a.second.second);
    if (cn == k) break;
    if (a.first == 1) continue;
    if (a.first == a.second.first) {
      pq.push({a.first - 1, a.second});
    } else {
      pq.push({a.first - 1, {a.second.first, 2 * a.second.second}});
    }
  }
  cout << ans << endl;
  return 0;
}
