#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, k;
string s, t;
cin >> n >> k >> s >> t;
const int md = 1e9 + 7;
auto mul = [&](int a, int b) -> int {
return (long long) a * b % md;
};
auto add = [&](int a, int b) {
return (a += b - md) < 0 ? a + md : a;
};
auto inv = [&](int a) {
int s = 1, t = 0, b = md;
while (b) {
int q = a / b;
swap(s -= q * t, t);
swap(a -= q * b, b);
}
return s < 0 ? s + md : s;
};
vector<int> pw(k + 1);
pw[0] = 1;
for (int i = 0; i < k; i++) {
pw[i + 1] = mul(pw[i], 25);
}
vector<int> fact(n + 1), ifact(n + 1);
fact[0] = 1;
for (int i = 0; i < n; i++) {
fact[i + 1] = mul(i + 1, fact[i]);
}
ifact[n] = inv(fact[n]);
for (int i = n - 1; i >= 0; i--) {
ifact[i] = mul(i + 1, ifact[i + 1]);
}
auto binom = [&](int n, int m) {
if (n < m) {
return 0;
}
return mul(fact[n], mul(ifact[n - m], ifact[m]));
};
int ans = 0;
for (int i = 0; i < n; i++) {
if (k == 0) {
break;
}
int d;
int ti = t[i] - 'a';
int si = s[i] - 'a';
if (ti <= si) {
d = mul(ti, mul(pw[k - 1], binom(n - i - 1, k - 1)));
} else {
d = mul(pw[k], binom(n - i - 1, k));
if (ti > 1) {
d = add(d, mul(ti - 1, mul(binom(n - i - 1, k - 1), pw[k - 1])));
}
}
ans = add(ans, d);
k -= (si != ti);
}
cout << add(ans, 1) << endl;
cerr << "Time: " << double(clock()) / CLOCKS_PER_SEC << '\n';
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CiAgaW9zOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOwogIGNpbi50aWUobnVsbHB0cik7CiAgaW50IG4sIGs7CiAgc3RyaW5nIHMsIHQ7CiAgY2luID4+IG4gPj4gayA+PiBzID4+IHQ7CiAgY29uc3Q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