#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
const int INF = 1e9 + 7;
const int mod = 1e9 + 7;
vector<long long> G[N];
map<pair<long long, long long>, long long> mp;
long long n, k;
char s[N], t[N];
int main() {
  cin >> n >> k;
  scanf("%s%s", s + 1, t + 1);
  long long dep = 1, ans = 0;
  for (int i = 1; i <= n; i++) {
    if (dep >= k * 2) {
      ans = ans + k;
    } else {
      dep = dep * 2;
      if (s[i] == 'b') dep--;
      if (t[i] == 'a') dep--;
      ans = ans + min(dep, k);
    }
  }
  cout << ans << endl;
}
