#include<bits/stdc++.h>
using namespace std;

//defines
#define openin freopen("input.txt","r",stdin)
#define openout freopen("output.txt","w",stdout)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long
#define int long long
#define mod 1000000007
#define repr(i,x,y) for (__typeof(x) i=x;i>=y;i--)
#define rep(i,x,y) for (__typeof(x) i=x;i<=y;i++)
#define all(c) (c).begin(),(c).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair

/* Print pair */
template <typename T,typename S>
ostream & operator << (ostream &os , const pair<T,S> &v) {
    os << "(" ;
    os << v.first << "," << v.second << ")" ;
    return os ;
}
/* Print vector */
template <typename T>
ostream & operator << (ostream &os , const vector<T> &v) {
    os << "[" ;
    int sz = v.size() ;
    for(int i = 0 ; i < sz ; ++i) {
        os << v[i] ;
        if(i!=sz-1)os << "," ;
    }
    os << "]\n" ;
    return os ;
}
/* Print set */
template <typename T>
ostream & operator << (ostream &os , const set<T> &v) {
    T last = *v.rbegin() ;
    os << "[" ;
    for(auto it : v) {
        os << it  ;
        if(it != last) os << "," ;
    }
    os << "]\n" ;
    return os ;
}
/* Print Map */
template <typename T,typename S>
ostream & operator << (ostream &os , const map<T,S> &v) {
    for(auto it : v) {
        os << it.first << " : " << it.second << "\n" ;
    }
    return os ;
}
int power(int a , int b)
{
    int res = 1 ;
    while(b)
    {
        if(b%2) {
            res = (res * a) % mod ;
        }
        b/=2 ;
        a = (a*a) % mod ;
    }
    return res ;
}

//debug
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
        cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
const int N = 2e5 + 5 ;
int arr[N] , brr[N] ;
vector<int> pos[N] ;
int DP[N][405] ;
int32_t main()
{
    fast;
    int n , m , s , e ;
    cin >> n >> m >> s >> e ;
    for(int i = 1 ; i <= n ; ++i) cin >> arr[i] ;
    for(int j = 1 ; j <= m ; ++j) cin >> brr[j] ;
    for(int i = 1 ; i <= m ; ++i) {
        pos[brr[i]].push_back(i) ;
    }
    int k = s/e ;
    int ans = 0 ;
    for(int j = 1 ; j <= k ; ++j) DP[0][j] = mod ;
    for(int i = 1 ; i <= n ; ++i) {
        for(int j = 1 ; j <= k ; ++j) {
            DP[i][j] = DP[i-1][j] ;
            auto it = lower_bound(all(pos[arr[i]]),DP[i-1][j-1]+1) ;
            if(it != pos[arr[i]].end()) {
                DP[i][j] = min(DP[i][j] , *it) ;
            }
            if(s - j*e - (DP[i][j] + i) >= 0) {
                ans = max(ans , j) ;
            }
        }
    }
    cout << ans << endl ;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

//defines
#define openin freopen("input.txt","r",stdin)
#define openout freopen("output.txt","w",stdout)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long
#define int long long
#define mod 1000000007
#define repr(i,x,y) for (__typeof(x) i=x;i>=y;i--)
#define rep(i,x,y) for (__typeof(x) i=x;i<=y;i++)
#define all(c) (c).begin(),(c).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair

/* Print pair */
template <typename T,typename S>
ostream & operator << (ostream &os , const pair<T,S> &v) {
    os << "(" ;
    os << v.first << "," << v.second << ")" ;
    return os ;
}
/* Print vector */
template <typename T>
ostream & operator << (ostream &os , const vector<T> &v) {
    os << "[" ;
    int sz = v.size() ;
    for(int i = 0 ; i < sz ; ++i) {
        os << v[i] ;
        if(i!=sz-1)os << "," ;
    }
    os << "]\n" ;
    return os ;
}
/* Print set */
template <typename T>
ostream & operator << (ostream &os , const set<T> &v) {
    T last = *v.rbegin() ;
    os << "[" ;
    for(auto it : v) {
        os << it  ;
        if(it != last) os << "," ;
    }
    os << "]\n" ;
    return os ;
}
/* Print Map */
template <typename T,typename S>
ostream & operator << (ostream &os , const map<T,S> &v) {
    for(auto it : v) {
        os << it.first << " : " << it.second << "\n" ;
    }
    return os ;
}
int power(int a , int b)
{
    int res = 1 ;
    while(b)
    {
        if(b%2) {
            res = (res * a) % mod ;
        }
        b/=2 ;
        a = (a*a) % mod ;
    }
    return res ;
}

//debug
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
        cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
const int N = 2e5 + 5 ;
int arr[N] , brr[N] ;
vector<int> pos[N] ;
int DP[N][105] ;
int32_t main()
{
    fast;
    int n , m , s , e ;
    cin >> n >> m >> s >> e ;
    for(int i = 1 ; i <= n ; ++i) cin >> arr[i] ;
    for(int j = 1 ; j <= m ; ++j) cin >> brr[j] ;
    for(int i = 1 ; i <= m ; ++i) {
        pos[brr[i]].push_back(i) ;
    }
    int k = s/e ;
    int ans = 0 ;
    for(int j = 1 ; j <= k ; ++j) DP[0][j] = mod ;
    for(int i = 1 ; i <= n ; ++i) {
        for(int j = 1 ; j <= k ; ++j) {
            DP[i][j] = DP[i-1][j] ;
            auto it = lower_bound(all(pos[arr[i]]),DP[i-1][j-1]+1) ;
            if(it != pos[arr[i]].end()) {
                DP[i][j] = min(DP[i][j] , *it) ;
            }
            if(s - j*e - (DP[i][j] + i) >= 0) {
                ans = max(ans , j) ;
            }
        }
    }
    cout << ans << endl ;
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define II pair<int, int>
#define x first
#define y second
#define mp make_pair
using namespace std;
const int N = 1e5 + 69;
int n, m, s, e, f[N][305], oo = 1e9, res, a[N];
vector<int> val[N];
int get(int a, int id)
{
	int new_id = upper_bound(val[a].begin(), val[a].end(), id) - val[a].begin();
	if(new_id == val[a].size()) return oo;
	return val[a][new_id];
}
int main()
{
//	freopen("425C.inp", "r", stdin);
//	freopen("425C.out", "w", stdout);
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m >> s >> e;
	for(int i = 1; i <= n; i ++) cin >> a[i];
	for(int i = 1; i <= m; i ++){
		int b;
		cin >> b;
		val[b].pb(i);
	}
	for(int i = 0; i <= n; i ++)
		for(int j = 1; j <= s / e; j ++) f[i][j] = oo;
	for(int i = 1; i <= n; i ++)
		for(int j = 1; j <= s / e; j ++){
			f[i][j] = min(f[i - 1][j], get(a[i], f[i - 1][j - 1]));
			if(s >= i + f[i][j] + e * j) res = max(res, j);
		}
	cout << res;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 100005;

const int M = 305;

int a[N], b[N];
vector<int> val[N];
int pos[M];

int main() {
    int n, m, s, e;
    scanf("%d%d%d%d", &n, &m, &s, &e);

    int maxv = s / e;

    for (int i = 1; i <= n; i++) scanf("%d", a+i);
    for (int i = 1; i <= m; i++) {
        scanf("%d", b+i);
        val[b[i]].push_back(i);
    }

    int ans = 0;

    for (int i = 1; i <= maxv; i++) pos[i] = m+1;

    for (int i = 1; i <= n; i++) {
        for (int j = maxv; j >= 1; j--) {
            auto it = lower_bound(val[a[i]].begin(), val[a[i]].end(), pos[j-1]);
            if (it == val[a[i]].end()) continue;

            int tmp = *it;
            if (pos[j] > tmp) pos[j] = tmp;

            if (ans < j && s - e * j >= i+tmp) ans = j;
        }
    }

    printf("%d", ans);

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 100005;

const int M = 305;

int a[N], b[N];
vector<int> val[N];
int pos[M];

int main() {
    int n, m, s, e;
    scanf("%d%d%d%d", &n, &m, &s, &e);

    int maxv = s / e;

    for (int i = 1; i <= n; i++) scanf("%d", a+i);
    for (int i = 1; i <= m; i++) {
        scanf("%d", b+i);
        val[b[i]].push_back(i);
    }

    int ans = 0;

    for (int i = 1; i <= maxv; i++) pos[i] = m+1;

    for (int i = 1; i <= n; i++) {
        for (int j = maxv; j >= 1; j--) {
            auto it = upper_bound(val[a[i]].begin(), val[a[i]].end(), pos[j-1]);
            if (it == val[a[i]].end()) continue;

            int tmp = *it;
            if (pos[j] > tmp) pos[j] = tmp;

            if (ans < j && s - e * j >= i+tmp) ans = j;
        }
    }

    printf("%d", ans);

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int INF = (int) 1e9 + 123;
const ll LINF = (ll) 1e18 + 123;

#define sz(x) (int) (x).size()

void run();

int main() {
#ifndef LOCAL
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#endif
    run();
    return 0;
}

const int N = (int) 1e5 + 123;
const int K = 303;

int n, m, s, e;
int a[N], b[N];
int dp[N][K];

vector<int> pos[N];

void run() {
    cin >> n >> m >> s >> e;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    for (int i = 1; i <= m; i++) {
        cin >> b[i];
        pos[b[i]].push_back(i);
    }

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < K; j++) {
            dp[i][j] = INF;
        }
    }

    for (int i = 0; i <= n; i++) {
        dp[i][0] = -1;
    }

    int ans = 0;

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j < K; j++) {
            dp[i][j] = min(dp[i][j], dp[i - 1][j]);
            int p = dp[i - 1][j - 1];
            auto it = upper_bound(pos[a[i]].begin(), pos[a[i]].end(), p);
            if (it != pos[a[i]].end()) {
                int q = *it;
                dp[i][j] = min(dp[i][j], q);
            }

            if (i + dp[i][j] + j * e <= s) {
                ans = max(ans, j);
            }
        }
    }

    cout << ans << "\n";
}


#include <bits/stdc++.h>
using namespace std;

#define maxn 100002
#define FOR(i, l, r) for (int i=l; i<=r; ++i)
#define FORD(i, r, l) for (int i=r; i>=l; --i)
#define REP(i, r) for (int i=0; i<(int)r; ++i)
#define REPD(i, r) for (int i=(int)r-1; i>=0; --i)
#define fi first
#define se second
#define mk make_pair
#define nil NULL
#define y0 y902
#define y1 y232
#define x0 x92
#define x1 x899
#define next asdfa
#define sz size
#define Debug(X) {cerr << #X << " = " << X << '\n';}
#define PR(A, n) {cerr << #A << " = "; FOR(i, 1, n) cerr << A[i] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; REP(i, n) cerr << A[i] << ' '; cerr << '\n';}
typedef long long ll;
typedef double db;
typedef pair<db, db> dd;
typedef pair<int, int> ii;
typedef vector<int> vi;
const int inf = 1e9;
template<class T> int getbit(T x, int pos) {return (x>>(pos-1)) & 1;}
template<class T> void turn_on(T &x, int pos) {x = x | ((T)1<<(pos-1));}
template<class T> void turn_off(T &x, int pos) {x = x & ~((T)1<<(pos-1));}
template<class T> T sqr(T a) {return a*a;}

int n, a[maxn], f[maxn][302], MAX, s, e, b[maxn], m;
vector<int> p[maxn];

int bisect(int val, int pos) {
    if (val==inf) return n+1;
    int l = 0, r = int(p[val].sz())-1, mid = (l+r)/2;
    while (l!=mid && mid!=r) {
        if (p[val][mid]<pos) l = mid;
        else r = mid;
        mid = (l+r)/2;
    }
    FOR(i, l, r) {
        if (p[val][i]>=pos) return p[val][i];
    }
    return m+1;
}

int main() {
    //freopen("tseq.inp", "r", stdin);
    ios::sync_with_stdio(0); cin.tie(0);
    scanf("%d%d%d%d", &n, &m, &s, &e);
    FOR(i, 1, n) scanf("%d", &a[i]);
    FOR(i, 1, m) {
        scanf("%d", &b[i]);
        p[b[i]].push_back(i);
        MAX = max(MAX, b[i]);
    }
    FOR(i, 1, MAX) sort(p[i].begin(), p[i].end());
    FOR(i, 0, n) FOR(j, 0, s/e) f[i][j] = inf;
    FOR(i, 0, n) f[i][0] = 0;
    int res = 0;
    FOR(i, 1, n)
    FOR(j, 1, s/e) {
        f[i][j] = f[i-1][j];
        int tmp = bisect(a[i], f[i-1][j-1]+1);
        if (tmp!=m+1) {
            f[i][j] = min(f[i][j], tmp);
        }
        if (j*e+i+f[i][j]<=s) res = max(res, j);
    }
    printf("%d", res);
}


/*input
3 4 3006 1000
1 2 3
1 2 4 3
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define REP(i,j,k)     for(int i = j ; i < k ; ++i)
#define RREP(i,j,k)    for(int i = j ; i >=k ; --i)
#define A    first
#define B    second
#define mp   make_pair
#define pb   emplace_back
#define PII pair<int , int>
#define MEM(i,j)   memset(i , j , sizeof i)
#define ALL(i)     i.begin() , i.end()
#define DBGG(i,j)     cout << i << " " << j << endl
#define DB4(i,j,k,l)  cout << i << " " << j << " " << k << " " << l << endl
#define IOS cin.tie() , cout.sync_with_stdio(0)
#define endl "\n"
///------------------------------------------------------------
#define MAX 100900
#define INF 0x3f3f3f3f

int n , m , s , e;
int a[MAX] , b[MAX] , dp[MAX][310];
vector<int> v[MAX];
int32_t main(){
    IOS;
    cin >> n >> m >> s >> e;
    REP(i , 1 , n + 1) cin >> a[i];
    REP(i , 1 , m + 1) cin >> b[i];
    REP(i , 1 , m + 1) v[b[i]].pb(i);

    MEM(dp , INF);
    REP(i , 0 , n + 1) dp[i][0] = 0;
    int ans = 0;
    REP(i , 1 , n + 1){
        int po = 0;
        REP(j , 1 , 300){
            dp[i][j] = dp[i - 1][j];
            if(dp[i - 1][j - 1] != INF){
                // cout << "here" << endl;
                int tmp = dp[i - 1][j - 1];
                while(po < v[a[i]].size() && v[a[i]][po] <= tmp) po ++;
                if(po < v[a[i]].size()) dp[i][j] = min(dp[i][j] , v[a[i]][po]);
            }
            // DB4("dp = " , i , j , dp[i][j]);
            if(dp[i][j] != INF){
                int cost = i + dp[i][j] + j * e;
                if(cost <= s) ans = max(ans , j);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


#pragma GCC optimize("O3")

#include <bits/stdc++.h>

using namespace std;
const int N = 1e5 + 5;
int memo[N][305];
int mn[N];
vector<int> pos[N];
int a[N];
int b[N];

int solve(int idx, int l) {
    if (idx < 0) return 1e7;
    if (l == 1) {
        return mn[idx];
    }
    int &res = memo[idx][l];
    if (~res) return res;
    res = 1e7;
    res = min(res, solve(idx - 1, l));
    int p = solve(idx - 1, l - 1);
    if (p < 1e9) {
        p = *lower_bound(pos[a[idx]].begin(), pos[a[idx]].end(), p + 1);
        res = min(res, p);
    }
    return res;
}

int main() {
    //freopen("in.txt", "rt", stdin);
    memset(memo, -1, sizeof memo);
    int n, m, s, e, x;
    scanf("%d %d %d %d", &n, &m, &s, &e);
    for (int i = 0; i < n; ++i) {
        scanf("%d", a + i);
    }
    for (int i = 0; i < m; ++i) {
        scanf("%d", &x);
        pos[x].push_back(i);
    }
    for (int i = 1; i <= 100000; ++i) {
        pos[i].push_back(1e9);
    }
    mn[0] = pos[a[0]][0];
    for (int i = 1; i < n; ++i) {
        mn[i] = pos[a[i]][0];
        mn[i] = min(mn[i], mn[i - 1]);
    }
    int mx = s / e;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int k = 1; k <= mx; ++k) {
            int j = solve(i, k);
            if ((i + j + 2) <= s - (k * e)) {
                ans = max(ans, k);
            }
        }
    }
    printf("%d", ans);
}


#pragma GCC optimize("O3")

#include <bits/stdc++.h>

using namespace std;
const int N = 1e5 + 5;
int memo[N][305];
int mn[N];
vector<int> pos[N];
int a[N];
int b[N];

int solve(int idx, int l) {
    if (idx < 0) return 1e7;
    if (l == 1) {
        return mn[idx];
    }
    int &res = memo[idx][l];
    if (~res) return res;
    res = 1e7;
    res = min(res, solve(idx - 1, l));
    int p = solve(idx - 1, l - 1);
    p = *lower_bound(pos[a[idx]].begin(), pos[a[idx]].end(), p);
    res = min(res, p);
    return res;
}

int main() {
    //freopen("in.txt", "rt", stdin);
    memset(memo, -1, sizeof memo);
    int n, m, s, e, x;
    scanf("%d %d %d %d", &n, &m, &s, &e);
    for (int i = 0; i < n; ++i) {
        scanf("%d", a + i);
    }
    for (int i = 0; i < m; ++i) {
        scanf("%d", &x);
        pos[x].push_back(i);
    }
    for (int i = 1; i <= 100000; ++i) {
        pos[i].push_back(1e9);
    }
    mn[0] = pos[a[0]][0];
    for (int i = 1; i < n; ++i) {
        mn[i] = pos[a[i]][0];
        mn[i] = min(mn[i], mn[i - 1]);
    }
    int mx = s / e;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int k = 1; k <= mx; ++k) {
            int j = solve(i, k);
            if ((i + j + 2) <= s - (k * e)) {
                ans = max(ans, k);
            }
        }
    }
    printf("%d", ans);
}


#pragma GCC optimize("O3")

#include <bits/stdc++.h>

using namespace std;
const int N = 1e5 + 5;
int memo[N][305];
vector<int> pos[N];
int a[N];

int solve(int idx, int l) {
    if (idx < 0) return 1e7;
    if (l == 1) {
        return pos[a[idx]][0];
    }
    int &res = memo[idx][l];
    if (~res) return res;
    res = 1e7;
    res = min(res, solve(idx - 1, l));
    int p = solve(idx - 1, l - 1);
    p = *lower_bound(pos[a[idx]].begin(), pos[a[idx]].end(), p);
    res = min(res, p);
    return res;
}

int main() {
    //freopen("in.txt", "rt", stdin);
    memset(memo, -1, sizeof memo);
    int n, m, s, e, x;
    scanf("%d %d %d %d", &n, &m, &s, &e);
    for (int i = 0; i < n; ++i) {
        scanf("%d", a + i);
    }
    for (int i = 0; i < m; ++i) {
        scanf("%d", &x);
        pos[x].push_back(i);
    }
    for (int i = 1; i <= 100000; ++i) {
        pos[i].push_back(1e9);
    }
    int mx = s / e;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int k = 1; k <= mx; ++k) {
            int j = solve(i, k);
            if ((i + j + 2) <= s - (k * e)) {
                ans = max(ans, k);
            }
        }
    }
    printf("%d", ans);
}


#pragma GCC optimize("O3")

#include <bits/stdc++.h>

using namespace std;
const int N = 1e5 + 5;
int memo[N][305];
int mn[N];
vector<int> pos[N];
int a[N];
int b[N];

int solve(int idx, int l) {
    if (idx < 0) return 1e7;
    if (l == 1) {
        return mn[idx];
    }
    int &res = memo[idx][l];
    if (~res) return res;
    res = 1e7;
    res = min(res, solve(idx - 1, l));
    int p = solve(idx - 1, l - 1);
    p = *lower_bound(pos[a[idx]].begin(), pos[a[idx]].end(), p+1);
    res = min(res, p);
    return res;
}

int main() {
    //freopen("in.txt", "rt", stdin);
    memset(memo, -1, sizeof memo);
    int n, m, s, e, x;
    scanf("%d %d %d %d", &n, &m, &s, &e);
    for (int i = 0; i < n; ++i) {
        scanf("%d", a + i);
    }
    for (int i = 0; i < m; ++i) {
        scanf("%d", &x);
        pos[x].push_back(i);
    }
    for (int i = 1; i <= 100000; ++i) {
        pos[i].push_back(1e9);
    }
    mn[0] = pos[a[0]][0];
    for (int i = 1; i < n; ++i) {
        mn[i] = pos[a[i]][0];
        mn[i] = min(mn[i], mn[i - 1]);
    }
    int mx = s / e;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int k = 1; k <= mx; ++k) {
            int j = solve(i, k);
            if ((i + j + 2) <= s - (k * e)) {
                ans = max(ans, k);
            }
        }
    }
    printf("%d", ans);
}


#include <bits/stdc++.h>

using namespace std;

const int N = 100005;
int dp[2][N];
void solve() {
    int n,m,s,e;
    cin >> n >> m >> s >> e;
    vector<int> a(n);
    for (auto& x: a) {
        cin >> x;
    }
    vector<vector<int>> pos(N);
    for (int i = 1; i <= m; i++) {
        int x; cin >> x;
        pos[x].push_back(i);
    }

    int crt = 0;
    dp[0][0] = 0;
    int best = 0;
    for (int i = 1; i <= s/e; i++) {
        int nxt = crt ^ 1;
        memset(dp[nxt], 0x3f, sizeof dp[nxt]);
        for (int j = 0; j < n; j++) {
            int& res = dp[nxt][j+1];
            res = min(res, dp[nxt][j]);
            auto it = upper_bound(pos[a[j]].begin(), pos[a[j]].end(), dp[crt][j]);
            if (it != pos[a[j]].end()) {
                res = min(res, *it);
            }
            if (i*e + j+1 + res <= s) best = i;
        }
        crt ^= 1;
    }
    cout << best;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 1e5+5;

int dp[400][N], a[N], n, m, s, e, tmp;
ll ans;
vector<int> b[N];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin>>n>>m>>s>>e;
	for(int i=1; i<=n; i++)
		cin>>a[i];
	for(int j=1; j<=m; j++){
		cin>>tmp;
		b[tmp].push_back(j);
	}
	for(int i=1; i<=n; i++){
		dp[1][i] = b[a[i]].size() ? b[a[i]][0] : 1e9;
		if(e + i + dp[1][i] <= s)
			ans = 1;
	}
	for(int j=2; j<=s/e; j++){
		int minPos = 1e9;
		for(int i=1; i<=n; i++){
			vector<int>::iterator it = upper_bound(b[a[i]].begin(), b[a[i]].end(), minPos);
			if(it == b[a[i]].end())
				dp[j][i] = 1e9;
			else
				dp[j][i] = *it;
			if(j*e + i + dp[j][i] <= s)
				ans = j;
			minPos = min(minPos, dp[j-1][i]);
		}
	}
	cout<<ans<<"\n";
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 1e5+5;

int dp[400][N], a[N], n, m, s, e, tmp;
ll ans;
vector<int> b[N];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin>>n>>m>>s>>e;
	for(int i=1; i<=n; i++)
		cin>>a[i];
	for(int j=1; j<=m; j++){
		cin>>tmp;
		b[tmp].push_back(j);
	}
	for(int i=0; i<n; i++){
		dp[1][i] = b[a[i]].size() ? b[a[i]][0] : 1e9;
		if(e + i + dp[1][i] <= s)
			ans = 1;
	}
	for(int j=2; j<=s/e; j++){
		int minPos = 1e9;
		for(int i=1; i<=n; i++){
			vector<int>::iterator it = upper_bound(b[a[i]].begin(), b[a[i]].end(), minPos);
			if(it == b[a[i]].end())
				dp[j][i] = 1e9;
			else
				dp[j][i] = *it;
			if(j*e + i + dp[j][i] <= s)
				ans = j;
			minPos = min(minPos, dp[j-1][i]);
		}
	}
	cout<<ans<<"\n";
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 1e5+5;

int dp[400][N], a[N], n, m, s, e, tmp;
ll ans;
vector<int> b[N];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin>>n>>m>>s>>e;
	for(int i=1; i<=n; i++)
		cin>>a[i];
	for(int j=1; j<=m; j++){
		cin>>tmp;
		b[tmp].push_back(j);
	}
	for(int i=0; i<n; i++){
		dp[1][i] = b[a[i]].size() ? b[a[i]][0] : 1e9;
		if(e + i + dp[1][i] <= s)
			ans = 1;
	}
	for(int j=2; j<=s/e; j++){
		int minPos = 1e9;
		for(int i=0; i<n; i++){
			vector<int>::iterator it = upper_bound(b[a[i]].begin(), b[a[i]].end(), minPos);
			if(it == b[a[i]].end())
				dp[j][i] = 1e9;
			else
				dp[j][i] = *it;
			if(j*e + i + dp[j][i] <= s)
				ans = j;
			minPos = min(minPos, dp[j-1][i]);
		}
	}
	cout<<ans<<"\n";
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 1e5+5;

int dp[400][N], a[N], n, m, s, e, tmp;
ll ans;
vector<int> b[N];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin>>n>>m>>s>>e;
	for(int i=0; i<n; i++)
		cin>>a[i];
	for(int j=0; j<m; j++){
		cin>>tmp;
		b[tmp].push_back(j);
	}
	for(int i=0; i<n; i++){
		dp[1][i] = b[a[i]].size() ? b[a[i]][0] : 1e9;
		if(e + i + dp[1][i] + 2 <= s)
			ans = 1;
	}
	for(int j=2; j<=s/e; j++){
		int minPos = 1e9;
		for(int i=0; i<n; i++){
			vector<int>::iterator it = upper_bound(b[a[i]].begin(), b[a[i]].end(), minPos);
			if(it == b[a[i]].end())
				dp[j][i] = 1e9;
			else
				dp[j][i] = *it;
			if(j*e + i + dp[j][i] +2 <= s)
				ans = j;
			minPos = min(minPos, dp[j-1][i]);
		}
	}
	cout<<ans<<"\n";
	return 0;
}


/*
@author: sharrad99
*/
#include<bits/stdc++.h>
using namespace std;
int main(){

	#ifndef ONLINE_JUDGE
	freopen("C:\\Users\\sharr\\Documents\\Input.txt", "r", stdin);
	freopen("C:\\Users\\sharr\\Documents\\Output.txt", "w", stdout);
	#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int n, k;
	cin >> n >> k;

	string s;
	cin >> s;

	vector<vector<bool>> dp(n + 1, vector<bool>(2 * k + 1, false));
	dp[0][k] = true;
	for(int i = 0; i < n; i++) {
		if(s[i] == 'W') {
			for(int j = 0; j < 2 * k; j++) {
				dp[i + 1][j + 1] = (dp[i + 1][j + 1] or dp[i][j]);
			}
		} else if(s[i] == 'L') {
			for(int j = 1; j <= 2 * k; j++) {
				dp[i + 1][j - 1] = (dp[i + 1][j - 1] or dp[i][j]);
			}
		} else if(s[i] == 'D') {
			for(int j = 0; j <= 2 * k; j++) {
				dp[i + 1][j] = (dp[i + 1][j] or dp[i][j]);
			}
		} else if(s[i] == '?') {
			for(int j = 0; j <= 2 * k; j++) {
				if(j > 0) {
					dp[i + 1][j - 1] = (dp[i + 1][j - 1] or dp[i][j]);
				}

				if(j < 2 * k) {
					dp[i + 1][j + 1] = (dp[i + 1][j + 1] or dp[i][j]);
				}

				dp[i + 1][j] = (dp[i + 1][j] or dp[i][j]);
			}
		} else {
			assert(false);
		}

		if(i != n - 1) {
			dp[i + 1][0] = false, dp[i + 1][2 * k] = false;
		}
	}

	if(!dp[n][0] and !dp[n][2 * k]) {
		cout << "NO\n";
		return 0;
	}

	int now = (dp[n][0] ? 0 : 2 * k);
	for(int i = n - 1; i >= 0; i--) {
		if(s[i] == 'W') {
			--now;
		} else if(s[i] == 'L') {
			++now;
		} else if(s[i] == 'D') {
			now;
		} else if(s[i] == '?') {
			if(dp[i][now]) {
				s[i] = 'D';
			} else if(dp[i][now + 1]) {
				s[i] = 'L', ++now;
			} else if(dp[i][now - 1]) {
				s[i] = 'W', --now;
			} else {
				assert(false);
			}
		} else {
			assert(false);
		}
	}

	int bal = 0;
	for(int i = 0; i < n; i++) {
		if(s[i] == 'W') bal++;
		if(s[i] == 'L') bal--;
	}

	bal = abs(bal);
	assert(bal == k);

	cout << s << '\n';
}


// clang-format off
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#ifndef bhartiya
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#endif

#define int long long
typedef long long ll;
typedef long double ld;
typedef long double f80;
typedef pair<int, int> pii;
typedef gp_hash_table<int, int> umap;
typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update> oset;
typedef pair<pii, int> piii;
typedef vector<int> vi;
typedef vector<pii> vii;

#define INF 1000000000000000000ll
#define MOD 1000000007
#define EPS 1e-7
// #define PI 3.1415926535897932385
// #define PI acos(-1)

#define pb emplace_back
#define bitc __builtin_popcountll
#define mp make_pair
#define ff first
#define ss second
#define all(ar) ar.begin(), ar.end()
#define len(x) (int)x.length()

#define fr(i, a, b) for (int i = (a), _b = (b); i <= _b; i++)
#define rep(i, n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define frr(i, a, b) for (int i = (a), _b = (b); i >= _b; i--)
#define foreach(it, ar) for (auto it = ar.begin(); it != ar.end(); it++)
#define fil(ar, val) memset(ar, val, sizeof(ar))  // 0x3f for inf, 0x80 for -INF can also use with pairs

#ifdef bhartiya
template<typename T>
void __p(T a) { cout << a << " "; }
template<typename T>
void __p(std::vector<T> a) { cout << "{ "; for (auto p : a) __p(p); cout << "}"; }
template<typename T, typename F>
void __p(pair<T, F> a) { cout << "{ "; __p(a.first); __p(a.second); cout << "}"; }
template<typename T, typename ...Arg>
void __p(T a1, Arg ...a) { __p(a1); __p(a...); }
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cout<<name<<" : ";__p(arg1);cout<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
    int bracket=0,i=0;
    for(; ;i++)
        if(names[i]==','&&bracket==0)
            break;
        else if(names[i]=='(')
            bracket++;
        else if(names[i]==')')
            bracket--;
    const char *comma=names+i;
    cout.write(names,comma-names)<<" : ";
    __p(arg1);
    cout<<"| ";
    __f(comma+1,args...);
}
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define trace(...)
#define end_routine()
#endif

mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
inline bool equals(double a, double b) { return fabs(a - b) < 1e-9; }
ll modpow(ll b, ll e, ll mod=MOD) {
    ll ans=1; for(;e;b=b*b%mod,e/=2) if(e&1) ans=ans*b%mod; return ans; }

ll dp[1005][2005];
ll ch[1005][2005];
string st="";

void find(ll x,ll y)
{
    if(x<=0)
    {
        return;
    }
    ll z=ch[x][y];
    char ch='D';
    if(z==y+1)
    {
        ch='L';
    }
    else if(z==y-1)
    {
        ch='W';
    }
    find(x-1,z);
    st+=ch;
}

void solve()
{
    ll n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    if(n==1&&k==1)
    {
        if(s[0]=='W'||s[0]=='?')
        {
            cout<<'W'<<endl;
        }
        else
        {
            cout<<"NO";
        }
        return;
    }
    if(k>n)
    {
        cout<<"NO"<<endl;
        return;
    }
    dp[0][1000]=1;
    for(int i=1;i<n;i++)
    {
        if(s[i-1]=='?')
        {
            for(int j=1000-k+1;j<1000+k;j++)
            {
                if(dp[i-1][j])
                {
                    if(j+1!=1000+k)
                    {
                        // trace(i,j+1);
                        dp[i][j+1]=1;
                        ch[i][j+1]=j;
                    }
                    dp[i][j]=1;
                    ch[i][j]=j;
                    // trace(i,j);
                }
                if(dp[i-1][j+1])
                {
                    dp[i][j]=1;
                    ch[i][j]=j+1;
                }
            }
        }
        else
        {
            ll x=0;
            if(s[i-1]=='W')
            {
                x++;
            }
            else if(s[i-1]=='L')
                x--;
            // trace(x);
            for(ll j=1000-k+1;j<1000+k;j++)
            {
                if(abs(j+x-1000)!=k&&dp[i-1][j])
                {
                    // trace(i,j+x);
                    dp[i][j+x]=1;
                    ch[i][j+x]=j;
                }
            }
        }
    }
    if(s[n-1]=='?')
    {
        if(dp[n-1][1000+k-1]==1)
        {
            dp[n][1000+k]=1;
            ch[n][1000+k]=1000+k-1;
        }
        else if(dp[n-1][1000-k+1]==1)
        {
            dp[n][1000-k]=1;
            ch[n][1000-k]=1000-k+1;
        }
    }
    else
    {
        if(s[n-1]=='W'&&dp[n-1][1000+k-1])
        {
            dp[n][1000+k]=1;
            ch[n][1000+k]=1000+k-1;
        }
        else if(s[n-1]=='L'&&(dp[n-1][1000-k+1]==1))
        {
            dp[n][1000-k]=1;
            ch[n][1000-k]=1000-k+1;
        }
    }
    if(dp[n][1000+k])
    {
        find(n,1000+k);
        cout<<st<<endl;
    }
    else if(dp[n][1000-k])
    {
        find(n,1000-k);
        cout<<st<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }

}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0), cout.precision(15);   cout<<fixed;
#ifdef bhartiya
    cin.exceptions(cin.failbit);
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int t=1;
    // cin>>t;
    fr(i,1,t)
    {
        solve();
    }
    end_routine();
}


// clang-format off
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#ifndef bhartiya
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#endif

#define int long long
typedef long long ll;
typedef long double ld;
typedef long double f80;
typedef pair<int, int> pii;
typedef gp_hash_table<int, int> umap;
typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update> oset;
typedef pair<pii, int> piii;
typedef vector<int> vi;
typedef vector<pii> vii;

#define INF 1000000000000000000ll
#define MOD 1000000007
#define EPS 1e-7
// #define PI 3.1415926535897932385
// #define PI acos(-1)

#define pb emplace_back
#define bitc __builtin_popcountll
#define mp make_pair
#define ff first
#define ss second
#define all(ar) ar.begin(), ar.end()
#define len(x) (int)x.length()

#define fr(i, a, b) for (int i = (a), _b = (b); i <= _b; i++)
#define rep(i, n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define frr(i, a, b) for (int i = (a), _b = (b); i >= _b; i--)
#define foreach(it, ar) for (auto it = ar.begin(); it != ar.end(); it++)
#define fil(ar, val) memset(ar, val, sizeof(ar))  // 0x3f for inf, 0x80 for -INF can also use with pairs

#ifdef bhartiya
template<typename T>
void __p(T a) { cout << a << " "; }
template<typename T>
void __p(std::vector<T> a) { cout << "{ "; for (auto p : a) __p(p); cout << "}"; }
template<typename T, typename F>
void __p(pair<T, F> a) { cout << "{ "; __p(a.first); __p(a.second); cout << "}"; }
template<typename T, typename ...Arg>
void __p(T a1, Arg ...a) { __p(a1); __p(a...); }
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cout<<name<<" : ";__p(arg1);cout<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
    int bracket=0,i=0;
    for(; ;i++)
        if(names[i]==','&&bracket==0)
            break;
        else if(names[i]=='(')
            bracket++;
        else if(names[i]==')')
            bracket--;
    const char *comma=names+i;
    cout.write(names,comma-names)<<" : ";
    __p(arg1);
    cout<<"| ";
    __f(comma+1,args...);
}
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define trace(...)
#define end_routine()
#endif

mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
inline bool equals(double a, double b) { return fabs(a - b) < 1e-9; }
ll modpow(ll b, ll e, ll mod=MOD) {
    ll ans=1; for(;e;b=b*b%mod,e/=2) if(e&1) ans=ans*b%mod; return ans; }

ll dp[1005][2005];
ll ch[1005][2005];
string st="";

void find(ll x,ll y)
{
    if(x<=0)
    {
        return;
    }
    ll z=ch[x][y];
    char ch='D';
    if(z==y+1)
    {
        ch='L';
    }
    else if(z==y-1)
    {
        ch='W';
    }
    find(x-1,z);
    st+=ch;
}

void solve()
{
    ll n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    if(n==1&&k==1)
    {
        if(s[0]=='W'||s[0]=='?')
        {
            cout<<"YES"<<endl;
            cout<<'W'<<endl;
        }
        else
        {
            cout<<"NO";
        }
        return;
    }
    if(k>n)
    {
        cout<<"NO"<<endl;
        return;
    }
    dp[0][1000]=1;
    for(int i=1;i<n;i++)
    {
        if(s[i-1]=='?')
        {
            for(int j=1000-k+1;j<1000+k;j++)
            {
                if(dp[i-1][j])
                {
                    if(j+1!=1000+k)
                    {
                        // trace(i,j+1);
                        dp[i][j+1]=1;
                        ch[i][j+1]=j;
                    }
                    dp[i][j]=1;
                    ch[i][j]=j;
                    // trace(i,j);
                }
                if(dp[i-1][j+1])
                {
                    dp[i][j]=1;
                    ch[i][j]=j+1;
                }
            }
        }
        else
        {
            ll x=0;
            if(s[i-1]=='W')
            {
                x++;
            }
            else if(s[i-1]=='L')
                x--;
            // trace(x);
            for(ll j=1000-k+1;j<1000+k;j++)
            {
                if(abs(j+x-1000)!=k&&dp[i-1][j])
                {
                    // trace(i,j+x);
                    dp[i][j+x]=1;
                    ch[i][j+x]=j;
                }
            }
        }
    }
    if(s[n-1]=='?')
    {
        if(dp[n-1][1000+k-1]==1)
        {
            dp[n][1000+k]=1;
            ch[n][1000+k]=1000+k-1;
        }
        else if(dp[n-1][1000-k+1]==1)
        {
            dp[n][1000-k]=1;
            ch[n][1000-k]=1000-k+1;
        }
    }
    else
    {
        if(s[n-1]=='W'&&dp[n-1][1000+k-1])
        {
            dp[n][1000+k]=1;
            ch[n][1000+k]=1000+k-1;
        }
        else if(s[n-1]=='L'&&(dp[n-1][1000-k+1]==1))
        {
            dp[n][1000-k]=1;
            ch[n][1000+k]=1000-k+1;
        }
    }
    if(dp[n][1000+k])
    {
        cout<<"YES"<<endl;
        find(n,1000+k);
        cout<<st<<endl;
    }
    else if(dp[n][1000-k])
    {
        cout<<"YES"<<endl;
        find(n,1000-k);
        cout<<st<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }

}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0), cout.precision(15);   cout<<fixed;
#ifdef bhartiya
    cin.exceptions(cin.failbit);
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int t=1;
    // cin>>t;
    fr(i,1,t)
    {
        solve();
    }
    end_routine();
}


// clang-format off
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#ifndef bhartiya
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#endif

#define int long long
typedef long long ll;
typedef long double ld;
typedef long double f80;
typedef pair<int, int> pii;
typedef gp_hash_table<int, int> umap;
typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update> oset;
typedef pair<pii, int> piii;
typedef vector<int> vi;
typedef vector<pii> vii;

#define INF 1000000000000000000ll
#define MOD 1000000007
#define EPS 1e-7
// #define PI 3.1415926535897932385
// #define PI acos(-1)

#define pb emplace_back
#define bitc __builtin_popcountll
#define mp make_pair
#define ff first
#define ss second
#define all(ar) ar.begin(), ar.end()
#define len(x) (int)x.length()

#define fr(i, a, b) for (int i = (a), _b = (b); i <= _b; i++)
#define rep(i, n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define frr(i, a, b) for (int i = (a), _b = (b); i >= _b; i--)
#define foreach(it, ar) for (auto it = ar.begin(); it != ar.end(); it++)
#define fil(ar, val) memset(ar, val, sizeof(ar))  // 0x3f for inf, 0x80 for -INF can also use with pairs

#ifdef bhartiya
template<typename T>
void __p(T a) { cout << a << " "; }
template<typename T>
void __p(std::vector<T> a) { cout << "{ "; for (auto p : a) __p(p); cout << "}"; }
template<typename T, typename F>
void __p(pair<T, F> a) { cout << "{ "; __p(a.first); __p(a.second); cout << "}"; }
template<typename T, typename ...Arg>
void __p(T a1, Arg ...a) { __p(a1); __p(a...); }
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cout<<name<<" : ";__p(arg1);cout<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
    int bracket=0,i=0;
    for(; ;i++)
        if(names[i]==','&&bracket==0)
            break;
        else if(names[i]=='(')
            bracket++;
        else if(names[i]==')')
            bracket--;
    const char *comma=names+i;
    cout.write(names,comma-names)<<" : ";
    __p(arg1);
    cout<<"| ";
    __f(comma+1,args...);
}
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define trace(...)
#define end_routine()
#endif

mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
inline bool equals(double a, double b) { return fabs(a - b) < 1e-9; }
ll modpow(ll b, ll e, ll mod=MOD) {
    ll ans=1; for(;e;b=b*b%mod,e/=2) if(e&1) ans=ans*b%mod; return ans; }

ll dp[1005][2005];
ll ch[1005][2005];
string st="";

void find(ll x,ll y)
{
    if(x<=0)
    {
        return;
    }
    ll z=ch[x][y];
    char ch='D';
    if(z==y+1)
    {
        ch='L';
    }
    else if(z==y-1)
    {
        ch='W';
    }
    find(x-1,z);
    st+=ch;
}

void solve()
{
    ll n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    if(n==1&&k==1)
    {
        if(s[0]=='W'||s[0]=='?')
        {
            cout<<"YES"<<endl;
            cout<<'W'<<endl;
        }
        else
        {
            cout<<"NO";
        }
        return;
    }
    if(k>n)
    {
        cout<<"NO"<<endl;
        return;
    }
    dp[0][1000]=1;
    for(int i=1;i<n;i++)
    {
        if(s[i-1]=='?')
        {
            for(int j=1000-k+1;j<1000+k;j++)
            {
                if(dp[i-1][j])
                {
                    if(j+1!=1000+k)
                    {
                        // trace(i,j+1);
                        dp[i][j+1]=1;
                        ch[i][j+1]=j;
                    }
                    dp[i][j]=1;
                    ch[i][j]=j;
                    // trace(i,j);
                }
                if(dp[i-1][j+1])
                {
                    dp[i][j]=1;
                    ch[i][j]=j+1;
                }
            }
        }
        else
        {
            ll x=0;
            if(s[i-1]=='W')
            {
                x++;
            }
            else if(s[i-1]=='L')
                x--;
            // trace(x);
            for(ll j=1000-k+1;j<1000+k;j++)
            {
                if(abs(j+x-1000)!=k&&dp[i-1][j])
                {
                    // trace(i,j+x);
                    dp[i][j+x]=1;
                    ch[i][j+x]=j;
                }
            }
        }
    }
    if(s[n-1]=='?')
    {
        if(dp[n-1][1000+k-1]==1)
        {
            dp[n][1000+k]=1;
            ch[n][1000+k]=1000+k-1;
        }
        else if(dp[n-1][1000-k+1]==1)
        {
            dp[n][1000-k]=1;
            ch[n][1000-k]=1000-k+1;
        }
    }
    else
    {
        if(s[n-1]=='W'&&dp[n-1][1000+k-1])
        {
            dp[n][1000+k]=1;
            ch[n][1000+k]=1000+k-1;
        }
        else if(s[n-1]=='L'&&(dp[n-1][1000-k+1]==1))
        {
            dp[n][1000-k]=1;
            ch[n][1000+k]=1000-k+1;
        }
    }
    if(dp[n][1000+k])
    {
        find(n,1000+k);
        cout<<st<<endl;
    }
    else if(dp[n][1000-k])
    {
        find(n,1000-k);
        cout<<st<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }

}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0), cout.precision(15);   cout<<fixed;
#ifdef bhartiya
    cin.exceptions(cin.failbit);
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int t=1;
    // cin>>t;
    fr(i,1,t)
    {
        solve();
    }
    end_routine();
}


// clang-format off
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#ifndef bhartiya
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#endif

#define int long long
typedef long long ll;
typedef long double ld;
typedef long double f80;
typedef pair<int, int> pii;
typedef gp_hash_table<int, int> umap;
typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update> oset;
typedef pair<pii, int> piii;
typedef vector<int> vi;
typedef vector<pii> vii;

#define INF 1000000000000000000ll
#define MOD 1000000007
#define EPS 1e-7
// #define PI 3.1415926535897932385
// #define PI acos(-1)

#define pb emplace_back
#define bitc __builtin_popcountll
#define mp make_pair
#define ff first
#define ss second
#define all(ar) ar.begin(), ar.end()
#define len(x) (int)x.length()

#define fr(i, a, b) for (int i = (a), _b = (b); i <= _b; i++)
#define rep(i, n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define frr(i, a, b) for (int i = (a), _b = (b); i >= _b; i--)
#define foreach(it, ar) for (auto it = ar.begin(); it != ar.end(); it++)
#define fil(ar, val) memset(ar, val, sizeof(ar))  // 0x3f for inf, 0x80 for -INF can also use with pairs

#ifdef bhartiya
template<typename T>
void __p(T a) { cout << a << " "; }
template<typename T>
void __p(std::vector<T> a) { cout << "{ "; for (auto p : a) __p(p); cout << "}"; }
template<typename T, typename F>
void __p(pair<T, F> a) { cout << "{ "; __p(a.first); __p(a.second); cout << "}"; }
template<typename T, typename ...Arg>
void __p(T a1, Arg ...a) { __p(a1); __p(a...); }
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cout<<name<<" : ";__p(arg1);cout<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
    int bracket=0,i=0;
    for(; ;i++)
        if(names[i]==','&&bracket==0)
            break;
        else if(names[i]=='(')
            bracket++;
        else if(names[i]==')')
            bracket--;
    const char *comma=names+i;
    cout.write(names,comma-names)<<" : ";
    __p(arg1);
    cout<<"| ";
    __f(comma+1,args...);
}
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define trace(...)
#define end_routine()
#endif

mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
inline bool equals(double a, double b) { return fabs(a - b) < 1e-9; }
ll modpow(ll b, ll e, ll mod=MOD) {
    ll ans=1; for(;e;b=b*b%mod,e/=2) if(e&1) ans=ans*b%mod; return ans; }

ll dp[1005][2005];
ll ch[1005][2005];
string st="";

void find(ll x,ll y)
{
    if(x<=0)
    {
        return;
    }
    ll z=ch[x][y];
    char ch='D';
    if(z==y+1)
    {
        ch='L';
    }
    else if(z==y-1)
    {
        ch='W';
    }
    find(x-1,z);
    st+=ch;
}

void solve()
{
    ll n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    if(n==1&&k==1)
    {
        if(s[0]=='W'||s[0]=='?')
        {
            cout<<"YES"<<endl;
            cout<<'W'<<endl;
        }
        else
        {
            cout<<"NO";
        }
        return;
    }
    if(k>n)
    {
        cout<<"NO"<<endl;
        return;
    }
    dp[0][1000]=1;
    for(int i=1;i<n;i++)
    {
        if(s[i-1]=='?')
        {
            for(int j=1000-k+1;j<1000+k;j++)
            {
                if(dp[i-1][j])
                {
                    if(j+1!=1000+k)
                    {
                        // trace(i,j+1);
                        dp[i][j+1]=1;
                        ch[i][j+1]=j;
                    }
                    dp[i][j]=1;
                    ch[i][j]=j;
                    // trace(i,j);
                }
                if(dp[i-1][j+1])
                {
                    dp[i][j]=1;
                    ch[i][j]=j+1;
                }
            }
        }
        else
        {
            ll x=0;
            if(s[i-1]=='W')
            {
                x++;
            }
            else if(s[i-1]=='L')
                x--;
            // trace(x);
            for(ll j=1000-k+1;j<1000+k;j++)
            {
                if(abs(j+x-1000)!=k&&dp[i-1][j])
                {
                    // trace(i,j+x);
                    dp[i][j+x]=1;
                    ch[i][j+x]=j;
                }
            }
        }
    }
    if(s[n-1]=='?')
    {
        if(dp[n-1][1000+k-1]==1)
        {
            dp[n][1000+k]=1;
            ch[n][1000+k]=1000+k-1;
        }
        else if(dp[n-1][1000-k+1]==1)
        {
            dp[n][1000-k]=1;
            ch[n][1000-k]=1000-k+1;
        }
    }
    else
    {
        if(s[n-1]=='W'&&dp[n-1][1000+k-1])
        {
            dp[n][1000+k]=1;
            ch[n][1000+k]=1000+k-1;
        }
        else if(s[n-1]=='L'&&(dp[n-1][1000-k+1]==1))
        {
            dp[n][1000-k]=1;
            ch[n][1000-k]=1000-k+1;
        }
    }
    if(dp[n][1000+k])
    {
        find(n,1000+k);
        cout<<st<<endl;
    }
    else if(dp[n][1000-k])
    {
        find(n,1000-k);
        cout<<st<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }

}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0), cout.precision(15);   cout<<fixed;
#ifdef bhartiya
    cin.exceptions(cin.failbit);
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int t=1;
    // cin>>t;
    fr(i,1,t)
    {
        solve();
    }
    end_routine();
}


/*
    Darshan J Patel(Er.Strange0919)
    https://codeforces.com/profile/Er.Strange0919
    DA-IICT
    Gandhinagar
    INDIA
*/
///Expected value is Sum of expected values
///Libraries
#include <bits/stdc++.h>
#include <time.h>
using namespace std;
///Types
#define ll long long int
#define ld long double
#define D double
#define S string
#define pi pair<int,int>
#define pll pair<ll,ll>
#define ve vector
#define vi ve<int>
#define vll ve<ll>
#define vvl ve<vll>
#define vD ve<D>
#define vld ve<ld>
#define vc ve<c>
#define vs ve<S>
#define vb ve<bool>
#define vpi ve<pi>
#define vpll ve<pll>

///Macro expressions
#define FOR(i,a,b) for(i=a;i<b;i++)
#define FORI(i,a,b) for(ll i=a;i<b;i++)
#define nFOR(i,a,b) for(i=a;i>=b;i--)
#define nFORI(i,a,b) for(ll i=a;i>=b;i--)
#define times(x) FORI(i,0,x)
#define ntimes(x) nFORI(i,x-1,0)
#define deb(...) db(#__VA_ARGS__,__VA_ARGS__);
#define minQ(x) priority_queue<x,vector<x>,greater<x> >
#define maxQ(x) priority_queue<x,vector<x>,less<x> >
#define MEM(a,x) memset(a,x,sizeof(a))
#define rdd rdl()
#define rds rdstr()
#define cont(x) if(x) continue
#define break(x) if(x) break
#define all(x) x.begin(),x.end()
#define umap unordered_map
#define gcd __gcd
#define lb(a,x) lower_bound(all(a),x)-a.begin()
#define ub(a,x) upper_bound(all(a),x)-a.begin()
#define uniq(v) v.erase(unique(all(v)),v.end())
#define lower(x) transform(all(x),x.begin(),::tolower)
#define upper(x) transform(all(x),x.begin(),::toupper)
#define findx(a,x) (a.find(x)!=a.end())
#define rand(v) random_shuffle(all(v))
#define sz(x) ((ll)x.size())
#define prt(a) cout<<a
#define prec(x,d) cout<<fixed<<setprecision(d)<<x<<endl
#define SYNC ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define _ones(a) __builtin_popcountll(a)
#define re return
#define endl '\n'
#define no cout<<"NO\n"
#define yes cout<<"YES\n"
#define sim template<class T
#define Bye return 0;
///for taking line as input : getline(cin,mystr);

///Global Constants
const ll MOD = 1e9+7;
const ll INF = LLONG_MAX;
const double PI = 3.14159265358979323846;
const double eps = 1e-9;
//const int dx[] = {1,-1,0,0};
//const int dy[] = {0,0,1,-1};

///Global Vectors
///Functions
///Inputs
ll rdl(){ll x;cin>>x;re x;}
S rdstr(){S s;cin>>s;re s;}
sim> istream& operator>>(istream& in,ve<T>&v){for(T &e:v)in>>e;re in;}
sim> istream& operator>>(istream& in,ve<ve<T> >&v){for(ve<T>&e:v)for(T &ee:e)in>>ee;re in;}
sim,class Ta> istream& operator>>(istream& in,pair<T,Ta>&v){in>>v.ff>>v.ss;re in;}

///Output
sim> void pout(T xx){cout<<xx<<'\n';}
sim> void out(T xx){cout<<xx;exit(0);}
sim> ostream& operator<<(ostream& ot,const ve<T>&v){for(T e:v)ot<<e<<' ';re ot;}
sim> ostream& operator<<(ostream& ot,const ve<ve<T> >&v){for(ve<T>e:v)ot<<e<<(e==v[v.size()-1]?' ':'\n');re ot;}
sim,class Ta> ostream& operator<<(ostream& ot,const pair<T,Ta>&v){ot<<v.ff<<' '<<v.ss<<endl;re ot;}
sim,class Ta>ostream& operator<<(ostream& ot,const ve<pair<T,Ta> >&v){for(auto &e:v)ot<<e.ff<<' '<<e.ss<<'\n';re ot;}
sim> ostream& operator<<(ostream& ot,const set<T>&v){for(T &x:v)ot<<x<<' ';re ot;}
sim,class Ta> ostream& operator<<(ostream& ot,const map<T,Ta>&v){for(auto &x:v)ot<<x.ff<<' '<<x.ss<<endl;re ot;}

///Maths
sim> T add(T aa,T bb,ll m){return (T)(aa+bb)%m;}
sim> T mul(T aa,T bb,ll m){return (T)(aa*bb)%m;}
sim> T ceil(T x,T y){re x>=0?(x+y-1)/y:-(-x/y);}
sim> T floor(T x,T y){re x>=0?(x/y):-(-x+y-1)/y;}
sim> T lcm(T x,T y){re x/gcd(x,y)*y;}
sim> T power(T x,T n,ll m=MOD){T ans=1;for(;n;n>>=1,x=(x*x)%m)if(n&1)ans=(ans*x)%m;re ans;}
sim> T inv(T x,ll m){re power(x,m-2,m);}
sim> T sgn(T x){re (x<0)?-1:x?1:0;}
sim> bool in(T x,T l,T r){re((l<=x&&x<=r)||(r<=x&&x<=l));}
sim> bool sin(T x,T l,T r){re((l<x&&x<r)||(r<x&&x<l));}
ll mulmod(ll a,ll b,ll c=MOD)
{
	ll x = 0,y=a%c;
	while(b)
	{
	    if(b%2) x = (x+y)%c;
		y = (y*2)%c;
		b /= 2;
	}
	return x%c;
}

ll gcdExtended(ll a,ll b,ll &x,ll &y){
    if (a == 0){
        x = 0, y = 1;
        return b;
    }
    ll x1, y1; // To store results of recursive call
    ll g = gcdExtended(b%a, a, x1, y1);
    x = y1 - (b/a) * x1;
    y = x1;
    return g;
}
vb prime;
void sieve(ll n){
    prime.clear();
    prime.resize(n+1,true);
    for (int p=2; p*p<=n+1; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n+1; i += p)
                prime[i] = false;
        }
    }
    prime[1]=false;
}

///STL
sim> T sort(T &x){sort(all(x));re x;}
sim> T rsort(T &x){sort(all(x),__greater());re x;}
sim> T rev(T &x){reverse(all(x));re x;}

///Strings
string c2s(char ch){re string(1,ch);}
ll revi(ll x){S s;re stoi(rev(s=to_string(x)));}
bool ispal(S pa,ll sp,ll ep){for(;sp<ep;sp++,ep--)if(pa[sp]!=pa[ep])re 0;re 1;}
bool isvowel(char c){c=tolower(c);re (c=='a'||c=='e'||c=='i'||c=='o'||c=='u');}

///Here Goes!!!
int solve(){
    ll n=rdd,k=rdd;
    S s=rds;
    ll sum=0,len=0,diff;
    vll sums,lens;
    char x,c;
    times(n){
        x=s[i];
        if(x=='?'){
            if(sum) sums.pb(sum);
            sum=0;
            len++;
        }
        else{
            if(len) lens.pb(len);
            len=0;
            sum += (x=='W');
            sum -= (x=='L');
            //if(abs(sum)>k) out("NO");
            //if(abs(sum)==k && i!=n-1) out("NO");
        }
    }
    if(sum) sums.pb(sum);
    if(len) lens.pb(len);
    sum=0;
    len=0;
    for(auto x:sums) sum+=x;
    for(auto x:lens) len+=x;
    //cout<<sum<<' '<<len<<endl;
    if(in(k,sum-len,sum+len)) {
        diff=k-sum;
        if(diff<=0) c='L';
        else c='W';
        diff=abs(diff);
        diff=len-diff;
        for(auto &x:s){
            if(x!='?') continue;
            if(diff){
                x='D';
                diff--;
            }
            else x=c;
        }
        out(s);
    }
    if(in(-k,sum-len,sum+len)){
        diff=k-abs(sum);
        if(diff>=0) c='L';
        else c='W';
        diff=abs(diff);
        diff=len-diff;
        for(auto &x:s){
            if(x!='?') continue;
            if(diff){
                x='D';
                diff--;
            }
            else x=c;
        }
        out(s);
    }
    out("NO");
}

int main(){
    SYNC
    ll t=1;
    times(t) solve();
    Bye
}


/*
    Darshan J Patel(Er.Strange0919)
    https://codeforces.com/profile/Er.Strange0919
    DA-IICT
    Gandhinagar
    INDIA
*/
///Expected value is Sum of expected values
///Libraries
#include <bits/stdc++.h>
#include <time.h>
using namespace std;
///Types
#define ll long long int
#define ld long double
#define D double
#define S string
#define pi pair<int,int>
#define pll pair<ll,ll>
#define ve vector
#define vi ve<int>
#define vll ve<ll>
#define vvl ve<vll>
#define vD ve<D>
#define vld ve<ld>
#define vc ve<c>
#define vs ve<S>
#define vb ve<bool>
#define vpi ve<pi>
#define vpll ve<pll>

///Macro expressions
#define FOR(i,a,b) for(i=a;i<b;i++)
#define FORI(i,a,b) for(ll i=a;i<b;i++)
#define nFOR(i,a,b) for(i=a;i>=b;i--)
#define nFORI(i,a,b) for(ll i=a;i>=b;i--)
#define times(x) FORI(i,0,x)
#define ntimes(x) nFORI(i,x-1,0)
#define deb(...) db(#__VA_ARGS__,__VA_ARGS__);
#define minQ(x) priority_queue<x,vector<x>,greater<x> >
#define maxQ(x) priority_queue<x,vector<x>,less<x> >
#define MEM(a,x) memset(a,x,sizeof(a))
#define rdd rdl()
#define rds rdstr()
#define cont(x) if(x) continue
#define break(x) if(x) break
#define all(x) x.begin(),x.end()
#define umap unordered_map
#define gcd __gcd
#define lb(a,x) lower_bound(all(a),x)-a.begin()
#define ub(a,x) upper_bound(all(a),x)-a.begin()
#define uniq(v) v.erase(unique(all(v)),v.end())
#define lower(x) transform(all(x),x.begin(),::tolower)
#define upper(x) transform(all(x),x.begin(),::toupper)
#define findx(a,x) (a.find(x)!=a.end())
#define rand(v) random_shuffle(all(v))
#define sz(x) ((ll)x.size())
#define prt(a) cout<<a
#define prec(x,d) cout<<fixed<<setprecision(d)<<x<<endl
#define SYNC ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define _ones(a) __builtin_popcountll(a)
#define re return
#define endl '\n'
#define no cout<<"NO\n"
#define yes cout<<"YES\n"
#define sim template<class T
#define Bye return 0;
///for taking line as input : getline(cin,mystr);

///Global Constants
const ll MOD = 1e9+7;
const ll INF = LLONG_MAX;
const double PI = 3.14159265358979323846;
const double eps = 1e-9;
//const int dx[] = {1,-1,0,0};
//const int dy[] = {0,0,1,-1};

///Global Vectors
///Functions
///Inputs
ll rdl(){ll x;cin>>x;re x;}
S rdstr(){S s;cin>>s;re s;}
sim> istream& operator>>(istream& in,ve<T>&v){for(T &e:v)in>>e;re in;}
sim> istream& operator>>(istream& in,ve<ve<T> >&v){for(ve<T>&e:v)for(T &ee:e)in>>ee;re in;}
sim,class Ta> istream& operator>>(istream& in,pair<T,Ta>&v){in>>v.ff>>v.ss;re in;}

///Output
sim> void pout(T xx){cout<<xx<<'\n';}
sim> void out(T xx){cout<<xx;exit(0);}
sim> ostream& operator<<(ostream& ot,const ve<T>&v){for(T e:v)ot<<e<<' ';re ot;}
sim> ostream& operator<<(ostream& ot,const ve<ve<T> >&v){for(ve<T>e:v)ot<<e<<(e==v[v.size()-1]?' ':'\n');re ot;}
sim,class Ta> ostream& operator<<(ostream& ot,const pair<T,Ta>&v){ot<<v.ff<<' '<<v.ss<<endl;re ot;}
sim,class Ta>ostream& operator<<(ostream& ot,const ve<pair<T,Ta> >&v){for(auto &e:v)ot<<e.ff<<' '<<e.ss<<'\n';re ot;}
sim> ostream& operator<<(ostream& ot,const set<T>&v){for(T &x:v)ot<<x<<' ';re ot;}
sim,class Ta> ostream& operator<<(ostream& ot,const map<T,Ta>&v){for(auto &x:v)ot<<x.ff<<' '<<x.ss<<endl;re ot;}

///Maths
sim> T add(T aa,T bb,ll m){return (T)(aa+bb)%m;}
sim> T mul(T aa,T bb,ll m){return (T)(aa*bb)%m;}
sim> T ceil(T x,T y){re x>=0?(x+y-1)/y:-(-x/y);}
sim> T floor(T x,T y){re x>=0?(x/y):-(-x+y-1)/y;}
sim> T lcm(T x,T y){re x/gcd(x,y)*y;}
sim> T power(T x,T n,ll m=MOD){T ans=1;for(;n;n>>=1,x=(x*x)%m)if(n&1)ans=(ans*x)%m;re ans;}
sim> T inv(T x,ll m){re power(x,m-2,m);}
sim> T sgn(T x){re (x<0)?-1:x?1:0;}
sim> bool in(T x,T l,T r){re((l<=x&&x<=r)||(r<=x&&x<=l));}
sim> bool sin(T x,T l,T r){re((l<x&&x<r)||(r<x&&x<l));}
ll mulmod(ll a,ll b,ll c=MOD)
{
	ll x = 0,y=a%c;
	while(b)
	{
	    if(b%2) x = (x+y)%c;
		y = (y*2)%c;
		b /= 2;
	}
	return x%c;
}

ll gcdExtended(ll a,ll b,ll &x,ll &y){
    if (a == 0){
        x = 0, y = 1;
        return b;
    }
    ll x1, y1; // To store results of recursive call
    ll g = gcdExtended(b%a, a, x1, y1);
    x = y1 - (b/a) * x1;
    y = x1;
    return g;
}
vb prime;
void sieve(ll n){
    prime.clear();
    prime.resize(n+1,true);
    for (int p=2; p*p<=n+1; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n+1; i += p)
                prime[i] = false;
        }
    }
    prime[1]=false;
}

///STL
sim> T sort(T &x){sort(all(x));re x;}
sim> T rsort(T &x){sort(all(x),__greater());re x;}
sim> T rev(T &x){reverse(all(x));re x;}

///Strings
string c2s(char ch){re string(1,ch);}
ll revi(ll x){S s;re stoi(rev(s=to_string(x)));}
bool ispal(S pa,ll sp,ll ep){for(;sp<ep;sp++,ep--)if(pa[sp]!=pa[ep])re 0;re 1;}
bool isvowel(char c){c=tolower(c);re (c=='a'||c=='e'||c=='i'||c=='o'||c=='u');}

///Here Goes!!!
int solve(){
    ll n=rdd,k=rdd,z=1005,d,x;
    S s=rds;
    vvl dp(n+1,vll(2*z,0)),tr(n+1,vll(2*z,0));
    dp[0][z]=1;
    times(n){
        x=s[i];
        FORI(j,-k+1,k){///this initialization of loop is the whole trick ;)
                if(!dp[i][z+j]) continue;
                if(x=='W' || x=='?') dp[i+1][z+j+1]=1,tr[i+1][z+j+1]=1;
                if(x=='D' || x=='?') dp[i+1][z+j]=1,tr[i+1][z+j]=0;
                if(x=='L' || x=='?') dp[i+1][z+j-1]=1,tr[i+1][z+j-1]=-1;
        }
    }
    if(dp[n][z+k]){
        while(n--){
            d=tr[n+1][z+k];
            k-=d;
            if(d<0) s[n]='L';
            else if(d) s[n]='W';
            else s[n]='D';
        }
        out(s);
    }
    if(dp[n][z-k]){
        while(n--){
            d=tr[n+1][z-k];
            k+=d;
            if(d<0) s[n]='L';
            else if(d) s[n]='W';
            else s[n]='D';
        }
        out(s);
    }
    out("NO");
}

int main(){
    SYNC
    ll t=1;
    times(t) solve();
    Bye
}


#include <bits/stdc++.h>

using namespace std;

#define letSIZE 26

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  vector<vector<int>> grid(n + 1, vector<int> (2 * k + 1, 0));
  grid[0][k] = 1;
  string str;
  cin >> str;
  for(int i = 0; i < n; i++)
  {
    for(int j = 1; j < 2 * k; j++)
    {
      if(grid[i][j] == 1)
      {
        if(str[i] == 'W')
        {
          grid[i + 1][j + 1] = 1;
        }
        else if(str[i] == 'D')
        {
          grid[i + 1][j] = 1;
        }
        else if(str[i] == 'L')
        {
          grid[i + 1][j - 1] = 1;
        }
        else if(str[i] == '?')
        {
          grid[i + 1][j + 1] = grid[i + 1][j] = grid[i + 1][j - 1] = 1;
        }
      }
    }
  }
  int start;
  string result, revrs;
  result = "";
  revrs = "";
  if(grid[n][0] == 1)
  {
    start = 1;
    revrs += 'L';
  }
  else if(grid[n][2 * k] == 1)
  {
    start = 2 * k - 1;
    revrs += 'W';
  }
  else
  {
    cout << "NO" << endl;
    return 0;
  }

  for(int i = n - 1, j = start; i > 0; i--)
  {
    if(j == 2 * k - 1)
    {
      if(grid[i - 1][j] == 1)
      {
        revrs += 'D';
      }
      else if(grid[i - 1][j - 1] == 1)
      {
        revrs += 'W';
        j--;
      }
    }
    else if(j == 0)
    {
      if(grid[i - 1][j + 1] == 1)
      {
        revrs += 'L';
        j++;
      }
      else if(grid[i - 1][j] == 1)
      {
        revrs += 'D';
      }
    }
    else
    {
      if(grid[i - 1][j + 1] == 1)
      {
        revrs += 'L';
        j++;
      }
      else if(grid[i - 1][j] == 1)
      {
        revrs += 'D';
      }
      else if(grid[i - 1][j - 1] == 1)
      {
        revrs += 'W';
        j--;
      }
    }
  }

  for(int i = 0; i < n; i++)
  {
    result += revrs[i];
  }

  cout << result << endl;

  return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define letSIZE 26

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  vector<vector<int>> grid(n + 1, vector<int> (2 * k + 1, 0));
  vector<vector<vector<int>>> path(n + 1, vector<vector<int>>(2 * k + 1, vector<int>(3, 0)));
  grid[0][k] = 1;
  string str;
  cin >> str;
  for(int i = 0; i < n; i++)
  {
    for(int j = 1; j < 2 * k; j++)
    {
      if(grid[i][j] == 1)
      {
        if(str[i] == 'W')
        {
          grid[i + 1][j + 1] = 1;
          path[i + 1][j + 1][2] = 1;
        }
        else if(str[i] == 'D')
        {
          grid[i + 1][j] = 1;
          path[i + 1][j + 1][1] = 1;
        }
        else if(str[i] == 'L')
        {
          grid[i + 1][j - 1] = 1;
          path[i + 1][j - 1][0] = 1;
        }
        else if(str[i] == '?')
        {
          grid[i + 1][j + 1] = grid[i + 1][j] = grid[i + 1][j - 1] = 1;
          path[i + 1][j + 1][2] = 1;
          path[i + 1][j][1] = 1;
          path[i + 1][j - 1][0] = 1;
        }
      }
    }
  }
  int start;
  string result, revrs;
  result = "";
  revrs = "";
  if(grid[n][0] == 1)
  {
    start = 1;
    revrs += 'L';
  }
  else if(grid[n][2 * k] == 1)
  {
    start = 2 * k - 1;
    revrs += 'W';
  }
  else
  {
    cout << "NO" << endl;
    return 0;
  }

  for(int i = n - 1, j = start; i > 0; i--)
  {
    if(path[i][j][0] == 1)
    {
      revrs += 'L';
      j++;
    }
    else if(path[i][j][1] == 1)
    {
      revrs += 'D';
    }
    else if(path[i][j][2] == 1)
    {
      revrs += 'W';
      j--;
    }
  }

  for(int i = n - 1; i >= 0; i--)
  {
    result += revrs[i];
  }

  cout << result << endl;

  return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define letSIZE 26

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  vector<vector<int>> grid(n + 1, vector<int> (2 * k + 1, 0));
  vector<vector<vector<int>>> path(n + 1, vector<vector<int>>(2 * k + 1, vector<int>(3, 0)));
  grid[0][k] = 1;
  string str;
  cin >> str;
  for(int i = 0; i < n; i++)
  {
    for(int j = 1; j < 2 * k; j++)
    {
      if(grid[i][j] == 1)
      {
        if(str[i] == 'W')
        {
          grid[i + 1][j + 1] = 1;
          path[i + 1][j + 1][2] = 1;
        }
        else if(str[i] == 'D')
        {
          grid[i + 1][j] = 1;
          path[i + 1][j][1] = 1;
        }
        else if(str[i] == 'L')
        {
          grid[i + 1][j - 1] = 1;
          path[i + 1][j - 1][0] = 1;
        }
        else if(str[i] == '?')
        {
          grid[i + 1][j + 1] = grid[i + 1][j] = grid[i + 1][j - 1] = 1;
          path[i + 1][j + 1][2] = 1;
          path[i + 1][j][1] = 1;
          path[i + 1][j - 1][0] = 1;
        }
      }
    }
  }
  int start;
  string result, revrs;
  result = "";
  revrs = "";
  if(grid[n][0] == 1)
  {
    start = 1;
    revrs += 'L';
  }
  else if(grid[n][2 * k] == 1)
  {
    start = 2 * k - 1;
    revrs += 'W';
  }
  else
  {
    cout << "NO" << endl;
    return 0;
  }

  for(int i = n - 1, j = start; i > 0; i--)
  {
    if(path[i][j][0] == 1)
    {
      revrs += 'L';
      j++;
    }
    else if(path[i][j][1] == 1)
    {
      revrs += 'D';
    }
    else if(path[i][j][2] == 1)
    {
      revrs += 'W';
      j--;
    }
  }

  for(int i = n - 1; i >= 0; i--)
  {
    result += revrs[i];
  }

  cout << result << endl;

  return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define letSIZE 26

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  vector<vector<int>> grid(n + 1, vector<int> (2 * k + 1, 0));
  grid[0][k] = 1;
  string str;
  cin >> str;
  for(int i = 0; i < n; i++)
  {
    for(int j = 1; j < 2 * k; j++)
    {
      if(grid[i][j] == 1)
      {
        if(str[i] == 'W')
        {
          grid[i + 1][j + 1] = 1;
        }
        else if(str[i] == 'D')
        {
          grid[i + 1][j] = 1;
        }
        else if(str[i] == 'L')
        {
          grid[i + 1][j - 1] = 1;
        }
        else if(str[i] == '?')
        {
          grid[i + 1][j + 1] = grid[i + 1][j] = grid[i + 1][j - 1] = 1;
        }
      }
    }
  }
  int start;
  string result, revrs;
  result = "";
  revrs = "";
  if(grid[n][0] == 1)
  {
    start = 1;
    revrs += 'L';
  }
  else if(grid[n][2 * k] == 1)
  {
    start = 2 * k - 1;
    revrs += 'W';
  }
  else
  {
    cout << "NO" << endl;
    return 0;
  }

  for(int i = n - 1, j = start; i > 0; i--)
  {
    if(j == 2 * k - 1)
    {
      if(grid[i - 1][j] == 1)
      {
        revrs += 'D';
      }
      else if(grid[i - 1][j - 1] == 1)
      {
        revrs += 'W';
        j--;
      }
    }
    else if(j == 1)
    {
      if(grid[i - 1][j + 1] == 1)
      {
        revrs += 'L';
        j++;
      }
      else if(grid[i - 1][j] == 1)
      {
        revrs += 'D';
      }
    }
    else
    {
      if(grid[i - 1][j + 1] == 1)
      {
        revrs += 'L';
        j++;
      }
      else if(grid[i - 1][j] == 1)
      {
        revrs += 'D';
      }
      else if(grid[i - 1][j - 1] == 1)
      {
        revrs += 'W';
        j--;
      }
    }
  }

  for(int i = 0; i < n; i++)
  {
    result += revrs[i];
  }

  cout << result << endl;

  return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define debug(x) cerr<<#x << " := " << x << endl;
#define bug cerr<<"-----------------------"<<endl;
#define FOR(a, b, c) for(int a = b; a <= c; ++ a)

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(ll &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }

template<typename T>
inline T read(T&x){
    x=0;int f=0;char ch=getchar();
    while (ch<'0'||ch>'9') f|=(ch=='-'),ch=getchar();
    while (ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x=f?-x:x;
}

const int inf = 0x3f3f3f3f;

const int mod = 1e9+7;

/**********showtime************/

            const int maxn = 1009;
            int dp[maxn][maxn * 2][3];
            char str[maxn];
            int n,k;
            int g(int x) {
                return x + k;
            }
            int get(char c) {
                if(c == 'W') return 1;
                if(c == 'D') return 0;
                return 2;
            }
            char put(int c){
                if(c == 1) return 'W';
                if(c == 2) return 'L';
                return 'D';
            }
int main(){
            scanf("%d%d", &n, &k);
            scanf("%s", str + 1);
            dp[0][g(0)][0] = 1;
            /// j = l - w

            for(int i=1; i<=n; i++) {

                for(int j=-k; j<=k; j++) {
                    if(str[i] == '?'){
                        if(abs(j) != k)
                        {
                            dp[i][g(j)][0] |= dp[i-1][g(j)][0];
                            dp[i][g(j)][0] |= dp[i-1][g(j)][1];
                            dp[i][g(j)][0] |= dp[i-1][g(j)][2];
                        }

                        if(j-1 > -k){
                            dp[i][g(j)][1] |= dp[i-1][g(j-1)][0];
                            dp[i][g(j)][1] |= dp[i-1][g(j-1)][1];
                            dp[i][g(j)][1] |= dp[i-1][g(j-1)][2];
                        }

                        if(j+1 < k) {
                            dp[i][g(j)][2] |= dp[i-1][g(j+1)][0];
                            dp[i][g(j)][2] |= dp[i-1][g(j+1)][1];
                            dp[i][g(j)][2] |= dp[i-1][g(j+1)][2];
                        }
                    }
                    else {
                        if(str[i] == 'D' ){
                            if(abs(j) != k) {
                                dp[i][g(j)][0] |= dp[i-1][g(j)][0];
                                dp[i][g(j)][0] |= dp[i-1][g(j)][1];
                                dp[i][g(j)][0] |= dp[i-1][g(j)][2];
                            }
                        }
                        else if(str[i] == 'W') {
                            if(j-1 > -k){
                                dp[i][g(j)][1] |= dp[i-1][g(j-1)][0];
                                dp[i][g(j)][1] |= dp[i-1][g(j-1)][1];
                                dp[i][g(j)][1] |= dp[i-1][g(j-1)][2];
                            }
                        }
                        else {
                            if(j+1 < k) {
                                dp[i][g(j)][2] |= dp[i-1][g(j+1)][0];
                                dp[i][g(j)][2] |= dp[i-1][g(j+1)][1];
                                dp[i][g(j)][2] |= dp[i-1][g(j+1)][2];
                            }
                        }
                    }

                }
            }

            int flag = 0;
            int dk, st;
            for(int i=0; i<=2; i++) {
                if(dp[n][g(k)][i]) flag = 1, dk = k, st = i;
            }
            for(int i=0; i<=2; i++) {
                if(dp[n][g(-k)][i]) flag = 1, dk = -k, st = i;
            }
            if(str[n] != '?') {
                if(dp[n][g(-k)][get(str[n])]) flag = 1,dk = -k, st = get(str[n]);
                if(dp[n][g(k)][get(str[n])]) flag = 1, dk =  k, st = get(str[n]);
            }

//            for(int i=1; i<=n; i++) {
//                for(int j = -k; j<=k; j++) {
//                    cout<<"( "<< dp[i][g(j)][0] << " , " <<dp[i][g(j)][1]<<" , "<< dp[i][g(j)][2]<<" ) ";
//                }
//
//                puts("");
//            }
            if(!flag) puts("NO");
            for(int i=n; i>=1; i--){
                str[i] = put(st);
                if(st == 2) dk++;
                else if(st == 1) dk--;
//                debug(dk);
                if(i == 1) break;
                if(str[i-1] == '?') {
                    if(dk - 1>-k && dp[i-1][g(dk)][1]) {
//                        dk++;
                        st = 1;
                    }
                    else if(dk+1<k &&  dp[i-1][g(dk)][2]) {
                        st = 2;
//                        dk--;
                    }
                    else {
                        st = 0;
                    }
                }
                else {
                    int pst = get(str[i-1]);
//                    if(pst == 1) dk++;
//                    if(pst == 2) dk--;
                    st = pst;
                }
            }
            printf("%s\n", str+1);
            return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define debug(x) cerr<<#x << " := " << x << endl;
#define bug cerr<<"-----------------------"<<endl;
#define FOR(a, b, c) for(int a = b; a <= c; ++ a)

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(ll &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }

template<typename T>
inline T read(T&x){
    x=0;int f=0;char ch=getchar();
    while (ch<'0'||ch>'9') f|=(ch=='-'),ch=getchar();
    while (ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x=f?-x:x;
}

const int inf = 0x3f3f3f3f;

const int mod = 1e9+7;

/**********showtime************/

            const int maxn = 1009;
            int dp[maxn][maxn * 2][3];
            char str[maxn];
            int n,k;
            int g(int x) {
                return x + k;
            }
            int get(char c) {
                if(c == 'W') return 1;
                if(c == 'D') return 0;
                return 2;
            }
            char put(int c){
                if(c == 1) return 'W';
                if(c == 2) return 'L';
                return 'D';
            }
int main(){
            scanf("%d%d", &n, &k);
            scanf("%s", str + 1);
            dp[0][g(0)][0] = 1;
            /// j = l - w

            for(int i=1; i<=n; i++) {

                for(int j=-k; j<=k; j++) {
                    if(str[i] == '?'){
                        if(abs(j) != k)
                        {
                            dp[i][g(j)][0] |= dp[i-1][g(j)][0];
                            dp[i][g(j)][0] |= dp[i-1][g(j)][1];
                            dp[i][g(j)][0] |= dp[i-1][g(j)][2];
                        }

                        if(j-1 > -k){
                            dp[i][g(j)][1] |= dp[i-1][g(j-1)][0];
                            dp[i][g(j)][1] |= dp[i-1][g(j-1)][1];
                            dp[i][g(j)][1] |= dp[i-1][g(j-1)][2];
                        }

                        if(j+1 < k) {
                            dp[i][g(j)][2] |= dp[i-1][g(j+1)][0];
                            dp[i][g(j)][2] |= dp[i-1][g(j+1)][1];
                            dp[i][g(j)][2] |= dp[i-1][g(j+1)][2];
                        }
                    }
                    else {
                        if(str[i] == 'D' ){
                            if(abs(j) != k) {
                                dp[i][g(j)][0] |= dp[i-1][g(j)][0];
                                dp[i][g(j)][0] |= dp[i-1][g(j)][1];
                                dp[i][g(j)][0] |= dp[i-1][g(j)][2];
                            }
                        }
                        else if(str[i] == 'W') {
                            if(j-1 > -k){
                                dp[i][g(j)][1] |= dp[i-1][g(j-1)][0];
                                dp[i][g(j)][1] |= dp[i-1][g(j-1)][1];
                                dp[i][g(j)][1] |= dp[i-1][g(j-1)][2];
                            }
                        }
                        else {
                            if(j+1 < k) {
                                dp[i][g(j)][2] |= dp[i-1][g(j+1)][0];
                                dp[i][g(j)][2] |= dp[i-1][g(j+1)][1];
                                dp[i][g(j)][2] |= dp[i-1][g(j+1)][2];
                            }
                        }
                    }

                }
            }

            int flag = 0;
            int dk, st;
            for(int i=0; i<=2; i++) {
                if(dp[n][g(k)][i]) flag = 1, dk = k, st = i;
            }
            for(int i=0; i<=2; i++) {
                if(dp[n][g(-k)][i]) flag = 1, dk = -k, st = i;
            }
            if(str[n] != '?') {
                if(dp[n][g(-k)][get(str[n])]) flag = 1,dk = -k, st = get(str[n]);
                if(dp[n][g(k)][get(str[n])]) flag = 1, dk =  k, st = get(str[n]);
            }

//            for(int i=1; i<=n; i++) {
//                for(int j = -k; j<=k; j++) {
//                    cout<<"( "<< dp[i][g(j)][0] << " , " <<dp[i][g(j)][1]<<" , "<< dp[i][g(j)][2]<<" ) ";
//                }
//
//                puts("");
//            }
            if(!flag) {
                puts("NO");
                return 0;
            }
            for(int i=n; i>=1; i--){
                str[i] = put(st);
                if(st == 2) dk++;
                else if(st == 1) dk--;
//                debug(dk);
                if(i == 1) break;
                if(str[i-1] == '?') {
                    if(dk - 1>-k && dp[i-1][g(dk)][1]) {
//                        dk++;
                        st = 1;
                    }
                    else if(dk+1<k &&  dp[i-1][g(dk)][2]) {
                        st = 2;
//                        dk--;
                    }
                    else {
                        st = 0;
                    }
                }
                else {
                    int pst = get(str[i-1]);
//                    if(pst == 1) dk++;
//                    if(pst == 2) dk--;
                    st = pst;
                }
            }
            printf("%s\n", str+1);
            return 0;
}


#include <bits/stdc++.h>
using i64 = long long;

char buf[1010];

[[noreturn]]
void no() {
    printf("NO\n");
    exit(0);
}

int main() {
    int n, k;
    scanf("%d%d%s", &n, &k, buf);

    std::vector<std::pair<int, int>> v { { 0, 0 } };
    int l = 0, r = 0;
    for (int i = 0; i < n - 1; i++) {
        if (buf[i] == 'W') {
            ++l;
            ++r;
        } else if (buf[i] == 'L') {
            --l;
            --r;
        } else if (buf[i] == '?') {
            --l;
            ++r;
        }

        l = std::max(l, -k + 1);
        r = std::min(r, k - 1);

        if (r < l) no();

        v.emplace_back(l, r);
    }

    int c;
    if (r == k - 1 && (buf[n - 1] == 'W' || buf[n - 1] == '?')) c = k;
    else if (l == -k + 1 && (buf[n - 1] == 'L' || buf[n - 1] == '?')) c = -k;
    else no();

    auto check = [](const auto &p, int k) {
        return p.first <= k && k <= p.second;
    };

    for (int i = n - 1; i >= 0; i--) {
        if (buf[i] == 'W') {
            --c;
        } else if (buf[i] == 'L') {
            ++c;
        } else if (buf[i] == '?') {
            if (check(v[i], c + 1)) {
                buf[i] = 'L';
                ++c;
            } else if (check(v[i], c - 1)) {
                buf[i] = 'W';
                --c;
            } else if (check(v[i], c)) {
                buf[i] = 'D';
            } else {
                no();
            }
        }
    }

    printf("%s\n", buf);

    return 0;
}


#include <bits/stdc++.h>
using i64 = long long;

char buf[1010];

[[noreturn]]
void no() {
    printf("NO\n");
    exit(0);
}

int main() {
    int n, k;
    scanf("%d%d%s", &n, &k, buf);

    std::vector<std::pair<int, int>> v { { 0, 0 } };
    int l = 0, r = 0;
    for (int i = 0; i < n; i++) {
        if (buf[i] == 'W') {
            ++l;
            ++r;
        } else if (buf[i] == 'L') {
            --l;
            --r;
        } else if (buf[i] == '?') {
            --l;
            ++r;
        }

        if (l >= k || r <= -k) no();

        v.emplace_back(l, r);
    }

    if (-k < l && r < k) no();

    int c = r >= k ? k : -k;
    for (int i = n - 1; i >= 0; i--) {
        if (buf[i] == 'W') {
            --c;
        } else if (buf[i] == 'L') {
            ++c;
        } else if (buf[i] == '?') {
            if (v[i].first > c || c == -k) {
                ++c;
                buf[i] = 'L';
            } else if (v[i].second < c || c == k) {
                --c;
                buf[i] = 'W';
            } else {
                buf[i] = 'D';
            }
        }

        if (c == k || c == -k) no();
    }

    printf("%s\n", buf);

    return 0;
}


#include <bits/stdc++.h>
using i64 = long long;

char buf[1010];

[[noreturn]]
void no() {
    printf("NO\n");
    exit(0);
}

int main() {
    int n, k;
    scanf("%d%d%s", &n, &k, buf);

    std::vector<std::pair<int, int>> v { { 0, 0 } };
    int l = 0, r = 0;
    for (int i = 0; i < n; i++) {
        if (buf[i] == 'W') {
            ++l;
            ++r;
        } else if (buf[i] == 'L') {
            --l;
            --r;
        } else if (buf[i] == '?') {
            --l;
            ++r;
        }

        if (l >= k || r <= -k) no();

        v.emplace_back(l, r);
    }

    if (-k < l && r < k) no();

    int c = r >= k ? k : -k;
    for (int i = n - 1; i >= 0; i--) {
        if (buf[i] == 'W') {
            --c;
        } else if (buf[i] == 'L') {
            ++c;
        } else if (buf[i] == '?') {
            if (v[i].first > c || c == -k || (v[i].second >= c + 1 && c > 0)) {
                ++c;
                buf[i] = 'L';
            } else if (v[i].second < c || c == k || (v[i].first <= c - 1 && c < 0)) {
                --c;
                buf[i] = 'W';
            } else {
                buf[i] = 'D';
            }
        }

        if (c == k || c == -k) no();
    }

    printf("%s\n", buf);

    return 0;
}


#include <bits/stdc++.h>
using i64 = long long;

char buf[1010];

int main() {
    int n, k;
    scanf("%d%d%s", &n, &k,  buf);

    std::string_view s(buf);
    std::vector dp(n + 1, std::vector<int>(2 * k + 1));
    const int base = k;

    dp[0][base] = 1;
    for (int i = 0; i < n; i++) {
        for (int j = -k + 1; j <= k - 1; j++) {
            if (dp[i][base + j] == 0) continue;
            if (s[i] == 'W') dp[i + 1][base + j + 1] = 1;
            else if (s[i] == 'L') dp[i + 1][base + j - 1] = 1;
            else if (s[i] == 'D') dp[i + 1][base + j] = 1;
            else {
                dp[i + 1][base + j + 1] = 1;
                dp[i + 1][base + j] = 1;
                dp[i + 1][base + j - 1] = 1;
            }
        }
    }

    // for (int i = 0; i < n; i++) for (int j = -k; j <= k; j++) {
    //     fprintf(stderr, "dp[%d][%d] = %d\n", i, j, dp[i][base + j]);
    // }

    if (!dp[n][base + k] && !dp[n][base - k]) {
        printf("NO\n");
        return 0;
    }

    int c = dp[n][base + k] ? k : -k;
    for (int i = n - 1; i >= 0; i--) {
        if (s[i] == 'W') --c;
        else if (s[i] == 'L') ++c;
        else if (s[i] == '?') {
            if (c - 1 > -k && dp[i][base + c - 1]) {
                buf[i] = 'W';
                --c;
            } else if (c + 1 < k && dp[i][base + c + 1]) {
                buf[i] = 'L';
                ++c;
            } else {
                buf[i] = 'D';
            }
        }
        assert(-k < c && c < k);
    }

    assert(!c);

    printf("%s\n", buf);

    return 0;
}


#include <bits/stdc++.h>
using i64 = long long;

char buf[1010];

int main() {
    int n, k;
    scanf("%d%d%s", &n, &k, buf);

    std::vector<std::pair<int, int>> v { { 0, 0 } };
    int l = 0, r = 0;
    for (int i = 0; i < n; i++) {
        if (buf[i] == 'W') {
            ++l;
            ++r;
        } else if (buf[i] == 'L') {
            --l;
            --r;
        } else if (buf[i] == '?') {
            --l;
            ++r;
        }

        if (l >= k || r <= -k) {
            printf("NO\n");
            return 0;
        }

        v.emplace_back(l, r);
    }

    if (-k < l && r < k) {
        printf("NO\n");
        return 0;
    }

    int c = r >= k ? k : -k;
    for (int i = n - 1; i >= 0; i--) {
        if (buf[i] == 'W') {
            --c;
        } else if (buf[i] == 'L') {
            ++c;
        } else if (buf[i] == '?') {
            if (v[i].first > c || c == -k) {
                ++c;
                buf[i] = 'L';
            } else if (v[i].second < c || c == k) {
                --c;
                buf[i] = 'W';
            } else {
                buf[i] = 'D';
            }
        }
    }

    printf("%s\n", buf);

    return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;

typedef long long ll;

int n, k, dp[1000][1000];
string s;

int v(char c) {
    if(c == 'W')
        return 1;
    if(c == 'L')
        return -1;
    return 0;
}

int f(int p, int d) {
    if(abs(d) == k && p == n)
        return 1;
    if(abs(d) == k)
        return 0;
    if(p == n)
        return 0;
    if(s[p] != '?')
        return f(p + 1, d + v(s[p]));
    for(auto c: {'W', 'L', 'D'}) {
        if(f(p + 1, d + v(c))) {
            s[p] = c;
            return 1;
        }
    }
    return 0;
}

int main() {
    memset(dp, -1, sizeof dp);
    cin >> n >> k >> s;
    if(f(0, 0))
        cout << s << endl;
    else
        cout << "NO" << endl;
}


#include<iostream>
#include<algorithm>

using namespace std;

typedef long long ll;

int n, k;
string s;

int v(char c) {
    if(c == 'W')
        return 1;
    if(c == 'L')
        return -1;
    return 0;
}

int f(int p, int d) {
    if(abs(d) == k && p == n)
        return 1;
    if(abs(d) == k)
        return 0;
    if(s[p] != '?')
        return f(p + 1, d + v(s[p]));
    for(auto c: {'W', 'L', 'D'}) {
        if(f(p + 1, d + v(c))) {
            s[p] = c;
            return 1;
        }
    }
    return 0;
}

int main() {
    cin >> n >> k >> s;
    if(f(0, 0))
        cout << s << endl;
    else
        cout << "NO" << endl;
}


#include<iostream>
#include<algorithm>

using namespace std;

typedef long long ll;

int n, k;
string s;

int v(char c) {
    if(c == 'W')
        return 1;
    if(c == 'L')
        return -1;
    return 0;
}

int f(int p, int d) {
    if(abs(d) == k && p == n)
        return 1;
    if(abs(d) == k)
        return 0;
    if(abs(d) == n)
        return 0;
    if(s[p] != '?')
        return f(p + 1, d + v(s[p]));
    for(auto c: {'W', 'L', 'D'}) {
        if(f(p + 1, d + v(c))) {
            s[p] = c;
            return 1;
        }
    }
    return 0;
}

int main() {
    cin >> n >> k >> s;
    if(f(0, 0))
        cout << s << endl;
    else
        cout << "NO" << endl;
}


#include<iostream>
#include<algorithm>
#include<csting>
using namespace std;

typedef long long ll;

int n, k, dp[1000][1000];
string s;

int v(char c) {
    if(c == 'W')
        return 1;
    if(c == 'L')
        return -1;
    return 0;
}

int f(int p, int d) {
    if(abs(d) == k && p == n)
        return 1;
    if(abs(d) == k)
        return 0;
    if(p == n)
        return 0;
    if(s[p] != '?')
        return f(p + 1, d + v(s[p]));
    for(auto c: {'W', 'L', 'D'}) {
        if(f(p + 1, d + v(c))) {
            s[p] = c;
            return 1;
        }
    }
    return 0;
}

int main() {
    memset(dp, -1, sizeof dp);
    cin >> n >> k >> s;
    if(f(0, 0))
        cout << s << endl;
    else
        cout << "NO" << endl;
}


#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;

typedef long long ll;

int n, k, dp[1000][2000];
string s;

int v(char c) {
    if(c == 'W')
        return 1;
    if(c == 'L')
        return -1;
    return 0;
}

int f(int p, int d) {
    if(abs(d) == k && p == n)
        return 1;
    if(abs(d) == k)
        return 0;
    if(p == n)
        return 0;
    if(dp[p][d + 1000] != -1)
        return dp[p][d + 1000];
    if(s[p] != '?')
        return dp[p][d + 1000] = f(p + 1, d + v(s[p]));
    for(auto c: {'W', 'L', 'D'}) {
        if(f(p + 1, d + v(c))) {
            s[p] = c;
            return dp[p][d + 1000] = 1;
        }
    }
    return dp[p][d + 1000] = 0;
}

int main() {
    memset(dp, -1, sizeof dp);
    cin >> n >> k >> s;
    if(f(0, 0))
        cout << s << endl;
    else
        cout << "NO" << endl;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define ld long double
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mod 1000000007
#define vll vector<ll>
#define inf 1e12
#define pll pair<ll,ll>
#define ff first
#define ss second
#define PI acos(-1)
#define pr 998244353
#define endl '\n'
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

//getline(cin, s);
//cout<<fixed<<setprecision(12)<<;
ll power(ll x,ll y)
{
	ll res=1;
	while(y>0)
	{
		if(y%2==1)res=(res*x)%pr;
		y=y/2;
		x=(x*x)%pr;
	}
	return res;
}

ll inv(ll a)
{
return power(a,pr-2);
}
/*
ll fact[2000007];
ll inr[2000007];
void pre()
{
	fact[0]=1;
	for(ll i=1;i<=2000005;i++)fact[i]=(fact[i-1]*i)%mod;
	inr[0]=1;
	for(ll i=1;i<=2000005;i++)inr[i]=inv(fact[i]);
}
ll ncr(ll n,ll r)
{
	ll a=(fact[n]*inr[r])%mod;
	ll b=(a*inr[n-r])%mod;
	return b;
}

ll spf[10000050];
void sieve()
{
	for(ll i=2;i*i<=10000030;i++)
	{
		if(spf[i]==0)
		{
			for(ll j=i+i;j<=10000030;j+=i)
			{
				if(spf[j]==0)
				{
					spf[j]=i;
				}
			}
		}
	}
}
*/
string s;
ll n,k;
ll dp[1005][2007];
ll ch[1005][2007];
int main()
{
	fastio;
	//pre();
	//sieve();
	int t=1;
	//cin>>t;
	while(t--)
	{
		cin>>n>>k>>s;
		dp[0][1005]=1;

		for(ll i=0;i<n;i++)
		{
			for(ll bal=-k+1;bal<k;bal++)
			{
				if(dp[i][bal+1005]==0)
				{
					continue;
				}
				if(s[i]=='W')
				{
					dp[i+1][bal+1005+1]=1;
					ch[i+1][bal+1005+1]=1;
				}
				else if(s[i]=='D')
				{
					dp[i+1][bal+1005]=1;
					ch[i+1][bal+1005]=0;
				}
				else if(s[i]=='L')
				{
					dp[i+1][bal+1005-1]=1;
					ch[i+1][bal+1005-1]=-1;
				}
				else if(s[i]=='?')
				{
					//dp[i+1][bal+1005]=1;
					ch[i+1][bal+1005-1]=-1;
					ch[i+1][bal+1005+1]=1;
					ch[i+1][bal+1005]=0;
					dp[i+1][bal+1005-1]=1;
					dp[i+1][bal+1005+1]=1;
					dp[i+1][bal+1005]=1;
				}
			}

		}
		if(dp[n][k+1005]==0&&dp[n][1005-k]==0)
			{
				cout<<"NO"<<endl;
			}
			else
			{
				char ans[1005];
				if(dp[n][k+1005]==1)
				{
					ll id=n,bal=k+1005;
					while(id>0)
					{
						ll d=ch[id][bal];
						if(d==1)
						{
							ans[id-1]='W';
							bal--;
						}
						else if(d==0)ans[id-1]='D';
						else
						{
							ans[id-1]='L';
							bal++;
						}
						id--;
					}
				}
				else
				{
					ll id=n,bal=1005-k;
					while(id>0)
					{
						ll d=ch[id][bal];
						if(d==1)
						{
							ans[id-1]='W';
							bal--;
						}
						else if(d==0)ans[id-1]='D';
						else
						{
							ans[id-1]='L';
							bal++;
						}
						id--;
					}
				}
				cout<<ans<<endl;
			}
	}
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define ld long double
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mod 1000000007
#define vll vector<ll>
#define inf 1e12
#define pll pair<ll,ll>
#define ff first
#define ss second
#define PI acos(-1)
#define pr 998244353
#define endl '\n'
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

//getline(cin, s);
//cout<<fixed<<setprecision(12)<<;
ll power(ll x,ll y)
{
	ll res=1;
	while(y>0)
	{
		if(y%2==1)res=(res*x)%pr;
		y=y/2;
		x=(x*x)%pr;
	}
	return res;
}

ll inv(ll a)
{
return power(a,pr-2);
}
/*
ll fact[2000007];
ll inr[2000007];
void pre()
{
	fact[0]=1;
	for(ll i=1;i<=2000005;i++)fact[i]=(fact[i-1]*i)%mod;
	inr[0]=1;
	for(ll i=1;i<=2000005;i++)inr[i]=inv(fact[i]);
}
ll ncr(ll n,ll r)
{
	ll a=(fact[n]*inr[r])%mod;
	ll b=(a*inr[n-r])%mod;
	return b;
}

ll spf[10000050];
void sieve()
{
	for(ll i=2;i*i<=10000030;i++)
	{
		if(spf[i]==0)
		{
			for(ll j=i+i;j<=10000030;j+=i)
			{
				if(spf[j]==0)
				{
					spf[j]=i;
				}
			}
		}
	}
}
*/
string s;
ll n,k;
ll dp[1005][2007];
ll ch[1005][2007];
int main()
{
	fastio;
	//pre();
	//sieve();
	int t=1;
	//cin>>t;
	while(t--)
	{
		cin>>n>>k>>s;
		dp[0][1005]=1;

		for(ll i=0;i<n;i++)
		{
			for(ll bal=-k+1;bal<k;bal++)
			{
				if(dp[i][bal+1005]==0)
				{
					continue;
				}
				if(s[i]=='W')
				{
					dp[i+1][bal+1005+1]=1;
					ch[i+1][bal+1005+1]=1;
				}
				else if(s[i]=='D')
				{
					dp[i+1][bal+1005]=1;
					ch[i+1][bal+1005]=0;
				}
				else if(s[i]=='L')
				{
					dp[i+1][bal+1005-1]=1;
					ch[i+1][bal+1005-1]=-1;
				}
				else if(s[i]=='?')
				{
					//dp[i+1][bal+1005]=1;
					ch[i+1][bal+1005-1]=-1;
					ch[i+1][bal+1005+1]=1;
					ch[i+1][bal+1005]=0;
					dp[i+1][bal+1005-1]=1;
					dp[i+1][bal+1005+1]=1;
					dp[i+1][bal+1005]=1;
				}
			}

		}
		if(dp[n][k+1005]==0&&dp[n][1005-k]==0)
			{
				cout<<"NO"<<endl;
			}
			else
			{
				//char ans[1005];
				string ans="";
				if(dp[n][k+1005]==1)
				{
					ll id=n,bal=k+1005;
					while(id>0)
					{
						ll d=ch[id][bal];
						if(d==1)
						{
							ans+='W';
							bal--;
						}
						else if(d==0)ans+='D';
						else
						{
							ans+='L';
							bal++;
						}
						id--;
					}
				}
				else
				{
					ll id=n,bal=1005-k;
					while(id>0)
					{
						ll d=ch[id][bal];
						if(d==1)
						{
							ans+='W';
							bal--;
						}
						else if(d==0)ans+='D';
						else
						{
							ans+='L';
							bal++;
						}
						id--;
					}
				}

				reverse(ans.begin(),ans.end());
				cout<<ans<<endl;
				//printf("%s",ans);
			}
	}
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define ld long double
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mod 1000000007
#define vll vector<ll>
#define inf 1e12
#define pll pair<ll,ll>
#define ff first
#define ss second
#define PI acos(-1)
#define pr 998244353
#define endl '\n'
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

//getline(cin, s);
//cout<<fixed<<setprecision(12)<<;
ll power(ll x,ll y)
{
	ll res=1;
	while(y>0)
	{
		if(y%2==1)res=(res*x)%pr;
		y=y/2;
		x=(x*x)%pr;
	}
	return res;
}

ll inv(ll a)
{
return power(a,pr-2);
}
/*
ll fact[2000007];
ll inr[2000007];
void pre()
{
	fact[0]=1;
	for(ll i=1;i<=2000005;i++)fact[i]=(fact[i-1]*i)%mod;
	inr[0]=1;
	for(ll i=1;i<=2000005;i++)inr[i]=inv(fact[i]);
}
ll ncr(ll n,ll r)
{
	ll a=(fact[n]*inr[r])%mod;
	ll b=(a*inr[n-r])%mod;
	return b;
}

ll spf[10000050];
void sieve()
{
	for(ll i=2;i*i<=10000030;i++)
	{
		if(spf[i]==0)
		{
			for(ll j=i+i;j<=10000030;j+=i)
			{
				if(spf[j]==0)
				{
					spf[j]=i;
				}
			}
		}
	}
}
*/
string s;
ll n,k;
ll dp[1005][2007];
ll ch[1005][2007];
int main()
{
	fastio;
	//pre();
	//sieve();
	int t=1;
	//cin>>t;
	while(t--)
	{
		cin>>n>>k>>s;
		dp[0][1005]=1;

		for(ll i=0;i<n;i++)
		{
			for(ll bal=-k+1;bal<k;bal++)
			{
				if(dp[i][bal+1005]==0)
				{
					continue;
				}
				if(s[i]=='W')
				{
					dp[i+1][bal+1005+1]=1;
					ch[i+1][bal+1005+1]=1;
				}
				else if(s[i]=='D')
				{
					dp[i+1][bal+1005]=1;
					ch[i+1][bal+1005]=0;
				}
				else if(s[i]=='L')
				{
					dp[i+1][bal+1005-1]=1;
					ch[i+1][bal+1005-1]=-1;
				}
				else if(s[i]=='?')
				{
					//dp[i+1][bal+1005]=1;
					ch[i+1][bal+1005-1]=-1;
					ch[i+1][bal+1005+1]=1;
					ch[i+1][bal+1005]=0;
					dp[i+1][bal+1005-1]=1;
					dp[i+1][bal+1005+1]=1;
					dp[i+1][bal+1005]=1;
				}
			}

		}
		if(dp[n][k+1005]==0&&dp[n][1005-k]==0)
			{
				cout<<"NO"<<endl;
			}
			else
			{
				char ans[1005];
				if(dp[n][k+1005]==1)
				{
					ll id=n,bal=k+1005;
					while(id>0)
					{
						ll d=ch[id][bal];
						if(d==1)
						{
							ans[id-1]='W';
							bal--;
						}
						else if(d==0)ans[id-1]='D';
						else
						{
							ans[id-1]='L';
							bal++;
						}
						id--;
					}
				}
				else
				{
					ll id=n,bal=1005-k;
					while(id>0)
					{
						ll d=ch[id][bal];
						if(d==1)
						{
							ans[id-1]='W';
							bal--;
						}
						else if(d==0)ans[id-1]='D';
						else
						{
							ans[id-1]='L';
							bal++;
						}
						id--;
					}
				}
				//cout<<ans<<endl;
				printf("%s",ans);
			}
	}
}