#include <bits/stdc++.h>
using namespace std;
const long long N = 5e5;
long long n, k, L[N + 2], R[N + 2], res;
string S, T;
void input() {
  cin >> n >> k >> S >> T;
  S = ' ' + S;
  T = ' ' + T;
}
void solve() {
  long long pos = n + 1;
  for (long long _b = n, i = 1; i <= _b; ++i) {
    L[i] = L[i - 1] * 2 + (S[i] - 'a' + 1);
    R[i] = R[i - 1] * 2 + (T[i] - 'a' + 1);
    if (L[i] == R[i]) L[i] = R[i] = 0;
    if (R[i] - L[i] + 1 >= k) {
      pos = i;
      break;
    }
  }
  for (long long _b = pos - 1, i = 1; i <= _b; ++i) res += R[i] - L[i] + 1;
  res += (n - pos + 1) * k;
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  input();
  solve();
  return 0;
}
