#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5, inf = 1e9 + 7;
long long n, k;
string s, t;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long i, j, a, b, ans = 0;
  cin >> n >> k >> s >> t;
  ans = n;
  i = 0;
  while (i < n && s[i] == t[i]) i++;
  long long t1 = 0, t2 = 0, a1 = 1, a2 = 1;
  k--;
  if (i < n && k) {
    ans += n - i;
    k--;
    i++;
  }
  for (; i < n; i++) {
    if (s[i] == 'a') {
      ans += min(k, t1 + 1) * (n - i);
      k -= min(k, t1 + 1);
      t1 = t1 * 2 + 1;
    } else {
      ans += min(k, t1) * (n - i);
      k -= min(k, t1);
      t1 *= 2;
    }
    if (t[i] == 'a') {
      ans += min(k, t2) * (n - i);
      k -= min(k, t2);
      t2 *= 2;
    } else {
      ans += min(k, t2 + 1) * (n - i);
      k -= min(k, t2 + 1);
      t2 = t2 * 2 + 1;
    }
    if (!k) break;
  }
  cout << ans;
}
