#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 10;
int k;
long long ans = 0;
void check(int has, int win) {
  int cant = min(k, has);
  ans += (long long)cant * win;
  k -= cant;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n >> k;
  string a, b;
  cin >> a >> b;
  bool eq = true;
  check(1, n);
  long long mid = 0;
  for (int i = int(0); i < int(n); i++) {
    if (eq) {
      if (a[i] != b[i]) {
        check(1, n - i);
        eq = false;
      }
    } else {
      check(mid, n - i);
      mid *= 2;
      if (a[i] == 'a') {
        check(1, n - i);
        mid++;
      }
      if (b[i] == 'b') {
        check(1, n - i);
        mid++;
      }
    }
    if (k == 0) break;
  }
  cout << ans << '\n';
  return 0;
}
