#include <bits/stdc++.h>
using namespace std;
long long n, k;
long long reached[500100][2][2];
int vis[500100][2][2];
long long dp[500100][2][2];
string s, b;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  k--;
  cin >> s >> b;
  memset(dp, -1, sizeof dp);
  long long ans = 0;
  queue<pair<long long, pair<long long, long long> > > Q;
  Q.push(make_pair(0, make_pair(0, 0)));
  reached[0][0][0] = 1;
  while (!Q.empty()) {
    int i = Q.front().first;
    long long biggerThanS = Q.front().second.first,
              smallerThanB = Q.front().second.second;
    Q.pop();
    if (i) ans += reached[i][biggerThanS][smallerThanB];
    if (i == n) continue;
    vector<char> can;
    if (!(s[i] == 'b' && !biggerThanS)) can.push_back('a');
    if (!(b[i] == 'a' && !smallerThanB)) can.push_back('b');
    if (can.size() == 2) {
      if (k >= reached[i][biggerThanS][smallerThanB]) {
        reached[i + 1][biggerThanS || (can[0] == 'b' && s[i] == 'a')]
               [smallerThanB || (can[0] == 'a' && b[i] == 'b')] +=
            reached[i][biggerThanS][smallerThanB];
        if (!vis[i + 1][biggerThanS || (can[0] == 'b' && s[i] == 'a')]
                [smallerThanB || (can[0] == 'a' && b[i] == 'b')]) {
          vis[i + 1][biggerThanS || (can[0] == 'b' && s[i] == 'a')]
             [smallerThanB || (can[0] == 'a' && b[i] == 'b')] = 1;
          Q.push(make_pair(
              i + 1,
              make_pair(biggerThanS || (can[0] == 'b' && s[i] == 'a'),
                        smallerThanB || (can[0] == 'a' && b[i] == 'b'))));
        }
        reached[i + 1][biggerThanS || (can[1] == 'b' && s[i] == 'a')]
               [smallerThanB || (can[1] == 'a' && b[i] == 'b')] +=
            reached[i][biggerThanS][smallerThanB];
        if (!vis[i + 1][biggerThanS || (can[1] == 'b' && s[i] == 'a')]
                [smallerThanB || (can[1] == 'a' && b[i] == 'b')]) {
          vis[i + 1][biggerThanS || (can[1] == 'b' && s[i] == 'a')]
             [smallerThanB || (can[1] == 'a' && b[i] == 'b')] = 1;
          Q.push(make_pair(
              i + 1,
              make_pair(biggerThanS || (can[1] == 'b' && s[i] == 'a'),
                        smallerThanB || (can[1] == 'a' && b[i] == 'b'))));
        }
        k -= reached[i][biggerThanS][smallerThanB];
      } else {
        reached[i + 1][biggerThanS || (can[0] == 'b' && s[i] == 'a')]
               [smallerThanB || (can[0] == 'a' && b[i] == 'b')] +=
            reached[i][biggerThanS][smallerThanB];
        if (!vis[i + 1][biggerThanS || (can[0] == 'b' && s[i] == 'a')]
                [smallerThanB || (can[0] == 'a' && b[i] == 'b')]) {
          vis[i + 1][biggerThanS || (can[0] == 'b' && s[i] == 'a')]
             [smallerThanB || (can[0] == 'a' && b[i] == 'b')] = 1;
          Q.push(make_pair(
              i + 1,
              make_pair(biggerThanS || (can[0] == 'b' && s[i] == 'a'),
                        smallerThanB || (can[0] == 'a' && b[i] == 'b'))));
        }
        reached[i + 1][biggerThanS || (can[1] == 'b' && s[i] == 'a')]
               [smallerThanB || (can[1] == 'a' && b[i] == 'b')] += k;
        if (!vis[i + 1][biggerThanS || (can[1] == 'b' && s[i] == 'a')]
                [smallerThanB || (can[1] == 'a' && b[i] == 'b')]) {
          vis[i + 1][biggerThanS || (can[1] == 'b' && s[i] == 'a')]
             [smallerThanB || (can[1] == 'a' && b[i] == 'b')] = 1;
          Q.push(make_pair(
              i + 1,
              make_pair(biggerThanS || (can[1] == 'b' && s[i] == 'a'),
                        smallerThanB || (can[1] == 'a' && b[i] == 'b'))));
        }
        k = 0;
      }
    } else {
      reached[i + 1][biggerThanS || (can[0] == 'b' && s[i] == 'a')]
             [smallerThanB || (can[0] == 'a' && b[i] == 'b')] +=
          reached[i][biggerThanS][smallerThanB];
      if (!vis[i + 1][biggerThanS || (can[0] == 'b' && s[i] == 'a')]
              [smallerThanB || (can[0] == 'a' && b[i] == 'b')]) {
        vis[i + 1][biggerThanS || (can[0] == 'b' && s[i] == 'a')]
           [smallerThanB || (can[0] == 'a' && b[i] == 'b')] = 1;
        Q.push(make_pair(
            i + 1, make_pair(biggerThanS || (can[0] == 'b' && s[i] == 'a'),
                             smallerThanB || (can[0] == 'a' && b[i] == 'b'))));
      }
    }
  }
  cout << ans << endl;
  return 0;
}
