#include <bits/stdc++.h>
using namespace std;
void solve(int n, int k, string s, string t) {
  int tmp = 1;
  long long result = 0;
  for (int i = 0; i < n; i++) {
    tmp *= 2;
    tmp -= (s[i] == 'b');
    tmp -= (t[i] == 'a');
    if (tmp > k) {
      tmp = k + 1;
    }
    result += (k > tmp ? tmp : k);
  }
  cout << result << endl;
}
int main() {
  int n, k;
  cin >> n >> k;
  string s, t;
  cin >> s >> t;
  solve(n, k, s, t);
}
