#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k, i;
  cin >> n >> k;
  string s1, s2;
  cin >> s1 >> s2;
  long long a = 0, b = 0;
  long long dif = 0;
  long long ans = 0;
  for (i = 0; i < n; i++) {
    a *= 2;
    b *= 2;
    a += s1[i] - 'a';
    b += s2[i] - 'a';
    if (dif != k) dif = min(b - a + 1, k);
    ans += dif;
  }
  cout << ans << "\n";
  return 0;
}
