#include <bits/stdc++.h>
using namespace std;
long long firstB = 0;
long long lastB = 0;
int MAX_STRINGS = 1000000000;
long long maxPrefixes(int strLength, int numStrings, string first,
                      string last) {
  long long pref = 0;
  long long distinct = 0;
  bool fin = false;
  for (int i = 0; i < strLength; i++) {
    if (pref <= MAX_STRINGS) {
      firstB = (firstB << 1);
      firstB += first[i] - 'a';
      lastB = (lastB << 1);
      lastB += last[i] - 'a';
      pref = lastB - firstB + 1;
    } else {
      fin = true;
    }
    if (pref <= numStrings && !fin) {
      distinct += pref;
    } else {
      distinct += numStrings;
    }
  }
  return distinct;
}
int main() {
  int strLength, numStrings;
  string first, last;
  cin >> strLength >> numStrings;
  cin >> first;
  cin >> last;
  cout << maxPrefixes(strLength, numStrings, first, last) << "\n";
  return 0;
}
