#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, k;
  cin >> n >> k;
  string s, t;
  cin >> s >> t;
  int max_strings = 1;
  long long rs = 0;
  for (int i = 0; i < n; ++i) {
    max_strings <<= 1;
    if (s[i] == 'b') max_strings--;
    if (t[i] == 'a') max_strings--;
    if (max_strings >= k) {
      for (int j = i; j < n; ++j) rs += k;
      break;
    }
    rs += max_strings;
  }
  cout << rs << "\n";
}
