#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const long double EPS = 1e-7;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  string s, t;
  cin >> s >> t;
  long long ans = 0, cnt = 1;
  for (long long i = 0; i < n; ++i) {
    cnt = min(cnt, (long long)1e17);
    cnt *= 2;
    cnt -= (s[i] == 'b') + (t[i] == 'a');
    ans += min(cnt, k);
  }
  cout << ans << endl;
  return 0;
}
