#include <bits/stdc++.h>
using namespace std;
const double DINF = numeric_limits<double>::infinity();
const long long MOD = 1e9 + 7;
const double EPS = 1e-7;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
mt19937 mmtw_(MOD);
uniform_int_distribution<long long> rd_;
long long randomll() { return rd_(mmtw_); }
long long rnd(long long x, long long y) { return rd_(mmtw_) % (y - x + 1) + x; }
long long n, k;
string second, t;
long long res, cnt, sum;
bool eq = true;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  cin >> second >> t;
  if (second > t) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    if (eq) {
      if (second[i] == t[i]) {
        res++;
      } else {
        assert(second[i] < t[i]);
        eq = false;
        res += min<long long>(2, k);
      }
    } else {
      cnt = min<long long>(cnt * 2, 1e9 + 5);
      if (second[i] == 'a') {
        cnt++;
      }
      if (t[i] == 'b') {
        cnt++;
      }
      res += min(cnt + 2, k);
    }
  }
  cout << res << endl;
}
