#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  string a, b;
  cin >> n >> k;
  cin >> a >> b;
  long long ans = 0;
  long long dd[2] = {0, 0}, tmp[2] = {0, 0};
  int flag = 0;
  for (int i = 0; i < n; i++) {
    long long t[2] = {a[i] - 'a', b[i] - 'a'};
    if (!flag)
      for (int j = 0; j < 2; j++) {
        tmp[j] = t[j] + 1 + dd[j], dd[j] += t[j] + 1;
        dd[j] <<= 1;
      }
    if (tmp[1] - tmp[0] + 1 >= k) flag = 1;
    if (flag)
      ans += k;
    else
      ans += tmp[1] - tmp[0] + 1;
  }
  cout << ans << endl;
  return 0;
}
