#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long powm(long long base, long long exp, long long mod = 1000000007) {
  base %= mod;
  long long ans = 1;
  while (exp) {
    if (exp & 1LL) ans = (ans * base) % mod;
    exp >>= 1LL, base = (base * base) % mod;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  string s, t;
  cin >> s >> t;
  if (s == t || k == 1) {
    cout << n << '\n';
    return 0;
  }
  int idx = -1;
  for (int i = 0; i < n; i++) {
    if (s[i] != t[i]) break;
    idx++;
  }
  long long ans = idx + 1;
  if (idx != -1) {
    s = s.substr(idx + 1, n - idx);
    t = t.substr(idx + 1, n - idx);
  }
  k -= 2;
  ans += 2 * (s.length());
  long long tot = 0;
  long long nos = 0;
  long long curr = 0;
  n = s.length();
  for (int i = 1; i < n; i++) {
    tot *= 2;
    if (s[i] == 'a') tot++;
    if (t[i] == 'b') tot++;
    curr = tot - nos;
    if (nos + curr >= k) {
      ans += (k - nos) * (n - i);
      nos = k;
      break;
    }
    ans += curr * (n - i);
    nos += curr;
  }
  cout << ans << '\n';
}
