#include <bits/stdc++.h>
using namespace std;
long long mod(long long a) {
  long long c = a % (long long)(1E9 + 7);
  if (c >= 0)
    return c;
  else
    return c + (long long)(1E9 + 7);
}
long long inf = (long long)1E12;
long long max(long long a, long long b) {
  if (a < b)
    return b;
  else
    return a;
}
long long min(long long a, long long b) {
  if (a > b)
    return b;
  else
    return a;
}
void Max(long long* pos, long long val) { *pos = max(*pos, val); }
void Min(long long* pos, long long val) { *pos = min(*pos, val); }
void Add(long long* pos, long long val) { *pos = mod(*pos + val); }
const long double EPS = 1E-8;
int main() {
  long long n, k;
  cin >> n >> k;
  string ss, tt;
  cin >> ss >> tt;
  if (k == 1) {
    cout << n << endl;
    return 0;
  }
  if (ss == tt) {
    cout << n << endl;
    return 0;
  }
  k -= 2;
  int same = 0;
  while (1) {
    if (ss[same] == tt[same]) {
      same++;
    } else {
      break;
    }
  }
  string s = ss.substr(same, n - same);
  string t = tt.substr(same, n - same);
  n = n - same;
  long long count[2][n + 1];
  memset(count, 0, sizeof(count));
  for (long long i = 1; i <= n - 1; i++) {
    long long d = n - i;
    if (s[i] == 'a') {
      if (d >= 1) count[0][d]++;
      if (d - 1 >= 1) count[1][d - 1]++;
    }
    if (t[i] == 'b') {
      if (d >= 1) count[0][d]++;
      if (d - 1 >= 1) count[1][d - 1]++;
    }
  }
  long long ans = same;
  for (long long i = n; i >= 1; i--) {
    if (count[0][i] <= k) {
      ans += count[0][i] * i;
      k -= count[0][i];
    } else {
      ans += k * i;
      k -= k;
    }
    if (count[1][i] <= k) {
      ans += count[1][i] * i;
      k -= count[1][i];
      count[1][i - 1] += count[1][i] * 2;
    } else {
      ans += k * i;
      k -= k;
    }
  }
  cout << ans + 2 * n << endl;
  return 0;
}
