#include <bits/stdc++.h>
using namespace std;
using namespace std;
const int maxn = 500005;
long long dp[maxn];
int main() {
  int n, k;
  string s, t;
  cin >> n >> k;
  cin >> s >> t;
  dp[0] = 1;
  for (int i = 1; i <= n; ++i) {
    char sc = s[i - 1], tc = t[i - 1];
    dp[i] = 2 * dp[i - 1];
    if (sc == 'b') {
      dp[i]--;
    }
    if (tc == 'a') {
      dp[i]--;
    }
    dp[i] = min(dp[i], 1ll * 1000 * 1000 * 1000 * 10);
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    ans += min(1ll * k, dp[i]);
  }
  cout << ans << "\n";
}
