Eva is fond of collecting coins. Whenever she visits a different country, she always picks up as many local coins as she can. As you know, Eva also likes to go trips to Europe; thus she has collected a large amount of Euro coins because so many countries in Europe use them.

Eva has nn Euro coins in total. She places all her coins on a desk in a row and plays a game with the coins. In one step Eva can choose exactly kk consecutive coins and flips them at the same time, provided that all heads of these coins face up or all heads of these coins face down. She wonders that, in finite steps, what states of the coins can be reached from the original state.

Input

The first line contains two integers, nn and kk (1 \le k \le n \le 10^61≤k≤n≤106) \text{---}—the number of Euro coins Eva owns and the number of consecutive coins Eva can flip in one step.

The next two lines contain two strings, ss and tt, respectively (|s| = |t| = n∣s∣=∣t∣=n). ss and tt only contain the digits 00 and 11.

ss represents the initial state of the nn coins: if the head of the ii-th coin faces up, then the ii-th character of ss is 11; otherwise (i.e. the head of ii-th coin faces down), the ii-th character of ss is 00.tt represents the desired final state of the nn coins in the same way as ss.

Output

If it is possible for Eva to reach the state represented by tt from the state represented by ss in finite steps, output "Yes"; otherwise, output "No" (without the quotes).

6 2 000000 101101

Yes

8 3 10101010 01010101

No

#include<bits/stdc++.h>using namespace std;typedef long long LL;int n,m;stack<char>st;stack<int>num;string cal(string s){    for(int i=0;i<s.size();i++)    {        if(!st.empty()&&st.top()==s[i])        {            //cout<<s[i]<<" "<<num.top()<<" "<<m<<endl;            if(num.top()+1==m)            {                st.pop();                num.pop();            }            else            {                int temp=num.top();                num.pop();                num.push(temp+1);            }        }        else        {            st.push(s[i]);            num.push(1);        }    }    string res="";    while(!st.empty())    {        char temp=st.top();        int num1=num.top();        for(int i=1;i<=num1;i++)        {            res+=temp;        }        st.pop();        num.pop();    }    //cout<<res<<endl;    return res;}string s1,s2;int main(){        scanf("%d%d",&n,&m) ;    cin>>s1>>s2;    if(m==1||cal(s1)==cal(s2))    {        printf("Yes\n");        }    else        printf("No\n");    return 0;}