#include <bits/stdc++.h>
using namespace std;
vector<int> graph[100001];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  long long int L = 0, R = 0, M = 0;
  long long int ans = 0;
  bool ex = false;
  string s1, s2;
  cin >> s1 >> s2;
  for (int i = 0; i < n; ++i) {
    if (L == 0) {
      if (s1[i] == s2[i])
        ans++;
      else {
        L = 1;
        R = 1;
      }
    } else {
      if (s1[i] == 'a') L++;
      if (s2[i] == 'b') R++;
      M *= 2;
    }
    if (L > 1) M += L - 1, L = 1;
    if (R > 1) M += R - 1, R = 1;
    int total = L + R + M;
    if (total >= k) ex = true;
    if (ex)
      ans += k;
    else
      ans += total;
  }
  cout << ans << endl;
  return 0;
}
