#include <bits/stdc++.h>
using namespace std;
struct Edge;
struct Edge {
  long long int to, weight;
  Edge(long long int to, long long int w) : to(to), weight(w) {}
};
const long long int mod = 1000000007;
void func() {
  long long int n, k;
  cin >> n >> k;
  string s, t;
  cin >> s >> t;
  if (k == 0) {
    cout << 0 << endl;
    return;
  }
  long long int accu = 0;
  long long int ans = n;
  k--;
  for (long long int i = 0; i < n; i++) {
    long long int newaccu = accu * 2;
    long long int x = s[i] - 'a', y = t[i] - 'a';
    if (x < y) {
      newaccu++;
    } else if (x > y) {
      newaccu--;
    }
    long long int c = (newaccu - accu);
    if (k <= c) {
      ans += k * (n - i);
      cout << ans << endl;
      return;
    }
    ans += c * (n - i);
    k -= c;
    accu = newaccu;
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int t = 1;
  for (long long int num = 1; num <= t; num++) {
    func();
  }
}
