#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n, k;
  string s, t;
  cin >> n >> k >> s >> t;
  long long ans = 0;
  long long inner = 0;
  bool eq = true;
  for (int i = 0; i < (int)(n); i++) {
    if (eq) {
      if (s[i] == t[i]) {
        ans += 1;
      } else {
        eq = false;
        inner = min<long long>(k, t[i] - s[i] - 1);
        ans += min<long long>(k, inner + 2);
      }
    } else {
      inner = min<long long>(k, inner * 2 + ('b' - s[i]) + (t[i] - 'a'));
      ans += min<long long>(k, inner + 2);
    }
  }
  cout << ans << endl;
  return 0;
}
