#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  int n, k;
  cin >> n >> k;
  string s, t;
  cin >> s >> t;
  int f_diff = 0;
  while (f_diff < n && s[f_diff] == t[f_diff]) f_diff++;
  if (f_diff == n) {
    cout << n << endl;
    return 0;
  }
  long long f_num = 0;
  long long s_num = 0;
  long long ans = f_diff;
  for (int i = f_diff; i < n; i++) {
    f_num = f_num * 2 + (s[i] == 'b');
    s_num = s_num * 2 + (t[i] == 'b');
    long long cnt = s_num - f_num + 1;
    if (cnt >= k) {
      ans += (long long)k * (n - i);
      break;
    }
    ans += cnt;
  }
  cout << ans << endl;
  return 0;
}
