#include <bits/stdc++.h>
using namespace std;
const int maxi = 1e6 + 10;
int n;
long long k;
string s, t;
long long w[maxi];
vector<pair<int, long long>> v[maxi];
long long dp[maxi];
long long ans;
int main() {
  cin >> n >> k;
  cin >> s;
  cin >> t;
  if (k == 1) {
    printf("%d\n", s.size());
    return 0;
  }
  int len = 0;
  while (len < n && s[len] == t[len]) len++;
  ans += s.size() + t.size() - len;
  long long veciS = 0;
  long long manjiT = 0;
  k -= 2;
  for (int i = len + 1; i < n; i++) {
    veciS *= 2;
    if (s[i] == 'a') {
      veciS++;
    }
    if (veciS > 1e9) veciS = 1e9;
    manjiT *= 2;
    if (t[i] == 'b') {
      manjiT++;
    }
    if (manjiT > 1e9) manjiT = 1e9;
    ans += min(manjiT + veciS, k);
  }
  cout << ans << endl;
  return 0;
}
