#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, k;
  cin >> n >> k;
  string s, t;
  cin >> s >> t;
  long long a[n + 1];
  a[0] = 1;
  for (long long i = 0, _n = (n); i < _n; i++) {
    if (s[i] == 'a' && t[i] == 'b') {
      a[i + 1] = min(k, a[i] * 2);
    } else if (s[i] == 'a' && t[i] == 'a') {
      a[i + 1] = min(k, 2 * a[i] - 1);
    } else if (s[i] == 'b' && t[i] == 'b') {
      a[i + 1] = min(k, 2 * a[i] - 1);
    } else {
      if (a[i] == 1)
        a[i + 1] = 1;
      else
        a[i + 1] = min(k, 2 * a[i] - 2);
    }
  }
  long long ans = 0;
  for (long long i = (1), _b = (n); i <= _b; i++) {
    ans = ans + a[i];
  }
  cout << ans << endl;
}
