#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, k;
  cin >> n >> k;
  string s, t;
  cin >> s >> t;
  vector<long long> a;
  a.push_back(1);
  a.push_back(1);
  long long cms = 1;
  while (cms <= k) {
    cms += cms;
    a.push_back(cms);
  }
  long long ans = 0;
  int j;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != t[i]) {
      j = i + 1;
      ans += 2;
      break;
    }
    j = i + 1;
    ans++;
  }
  vector<int> len;
  for (int i = j; i < s.size(); i++) {
    ans += 2;
    if (s[i] == 'a') {
      len.push_back(s.size() - i);
    }
    if (t[i] == 'b') {
      len.push_back(s.size() - i);
    }
  }
  long long mx;
  if (len.size()) mx = len[0];
  int i = 0;
  if (k == 1) ans = n;
  k -= 2;
  while (k > 0 && len.size() && mx > 0) {
    long long n = 0;
    for (int i = 0; i < len.size() && n < k; i++) {
      if (len[i] >= mx) {
        n += a[len[i] - mx];
      } else
        break;
    }
    n = min(k, n);
    ans += n * mx;
    mx--;
    k -= n;
  }
  cout << ans;
  return 0;
}
