#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>

const int MaxN = 500000;
using namespace std;

int dp[MaxN + 5];
char s[MaxN + 5], t[MaxN + 5];
int n, K;
int main() 
{
	while(~scanf("%d%d", &n, &K)) {
		scanf("%s%s", s + 1, t + 1);
		int ans = 0;
		for (int i = 1; i <= n; i++) {
			if(s[i] != t[i]) {
				ans++;
				if(i == n) {
					break;
				}
				int l = 1; while(l + i <= n && l < K && (t[i] == t[l + i] || t[l + i] == s[i])) l++;
				int now = i + l - 1;
				t[now] = s[i];
				int t = now;
				while(s[t] == s[now] && now > i) now--;
				int tmp = 0;
				for (int j = i; j < now; j++) {
					if(s[j] != s[i]) tmp++;
					else {
						ans += (tmp + K - 1) / K;
						tmp = 0;
					}
				}
				ans += (tmp + K - 1) / K;
				i = now;
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}

