#include <bits/stdc++.h>
using namespace std;
inline void print(int n) {
  if (n == 0) {
    putchar('0');
    putchar('\n');
  } else if (n == -1) {
    putchar('-');
    putchar('1');
    putchar('\n');
  } else {
    char buf[11];
    buf[10] = '\n';
    int i = 9;
    while (n) {
      buf[i--] = n % 10 + '0';
      n /= 10;
    }
    while (buf[i] != '\n') putchar(buf[++i]);
  }
}
int read() {
  int cc = getc(stdin);
  for (; cc < '0' || cc > '9';) cc = getc(stdin);
  int ret = 0;
  for (; cc >= '0' && cc <= '9';) {
    ret = ret * 10 + cc - '0';
    cc = getc(stdin);
  }
  return ret;
}
long long power(long long num, long long g) {
  if (g == 0) return 1;
  if (g % 2 == 1)
    return (num * power((num * num) % 1000000007, g / 2)) % 1000000007;
  return power((num * num) % 1000000007, g / 2);
}
vector<pair<long long, long long> > vec[300005];
long long a[300005];
long long ans;
long long dfs(int index, int parent) {
  long long sum = a[index];
  long long sum1 = 0, sum2 = 0;
  for (int i = 0; i < vec[index].size(); i++) {
    if (vec[index][i].first == parent) continue;
    long long g = dfs(vec[index][i].first, index);
    g -= vec[index][i].second;
    if (sum1 >= g) {
      sum2 = sum1;
      sum1 = g;
    } else
      sum2 = max(sum2, g);
  }
  return ans = max(ans, sum2 + sum1 + sum);
  return sum1 + sum;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k;
  cin >> n >> k;
  string s, t;
  cin >> s >> t;
  vector<string> vec;
  vec.push_back(s);
  vec.push_back(t);
  sort(vec.begin(), vec.end());
  s = vec[0];
  t = vec[1];
  long long ans = 0;
  long long x = 0;
  if (k == 1) {
    cout << n << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    if (s[i] == t[i]) {
      x *= (long long)2;
    } else if (s[i] == 'a') {
      x *= (long long)2;
      x++;
    } else {
      x *= (long long)2;
      x--;
    }
    x = min(x, k - 1);
    ans += x + 1;
  }
  cout << ans << endl;
  return 0;
}
