#include <bits/stdc++.h>
using namespace std;
long long dp[600000][2][2];
int main() {
  int n;
  long long K;
  scanf("%d%lld", &n, &K);
  string s, t;
  cin >> s >> t;
  dp[0][0][0] = 1;
  for (int i = 0; i < (n); i++)
    for (int j = 0; j < (2); j++)
      for (int k = 0; k < (2); k++) {
        int lim1 = (j ? 0 : s[i] - 'a'), lim2 = (k ? 1 : t[i] - 'a');
        dp[i][j][k] = min(dp[i][j][k], K);
        for (int l = lim1; l <= lim2; l++) {
          dp[i + 1][j || lim1 < l][k || l < lim2] += dp[i][j][k];
        }
      }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    long long cnt = 0;
    for (int j = 0; j < (2); j++)
      for (int k = 0; k < (2); k++) {
        cnt += dp[i][j][k];
      }
    ans += min(K, cnt);
  }
  cout << ans << endl;
}
