#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 10;
const int LG = 30;
const long long Inf = 1e9;
long long n, k;
string s, t;
long long dp[maxn], ans;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> k;
  cin >> s >> t;
  s = '#' + s;
  t = '#' + t;
  dp[0] = 1;
  for (int i = 1; i <= n; i++) {
    if (dp[i - 1] > 2) dp[i] = 1ll * (dp[i - 1] - 2ll) * 2ll, dp[i - 1] = 2;
    if (dp[i - 1] == 2) dp[i] += 'b' - s[i] + 1, dp[i] += t[i] - 'a' + 1;
    if (dp[i - 1] == 1) dp[i] += t[i] - s[i] + 1;
    if (dp[i] >= Inf) dp[i] = Inf;
    ans += min(dp[i], k);
  }
  cout << ans << '\n';
  return 0;
}
