#include <iostream>
#include <bits/stdc++.h>
using namespace std;
// typedef int int;
// typedef long double ld;
// #define N 3005
// #define mp make_pair
// #define v vector
// #define pb push_back
// #define fi first
// #define se second
// #define Aint(v) v.begin(), v.end()
// #define UN(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
string s;
int n, k;
vector<vector<int>> ans;
signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> k;
    cin >> s;
    int maxmoves = 0;
    while (true)
    {
        ans.push_back(vector<int>());
        for (int i = 0; i < n - 1; i++)
        {
            if (s[i + 1] == 'L' && s[i] == 'R')
            {
                s[i] = 'L';
                s[i + 1] = 'R';
                ans.back().push_back(i);
                i++;
            }
        }
        maxmoves += ans.back().size();
        if (ans.back().empty())
        {
            ans.pop_back();
            break;
        }
    }
    int minmoves = ans.size();
    if (k < minmoves || k > maxmoves)
    {
        cout << -1 << endl;
        return 0;
    }
    for (auto i : ans)
    {
        vector<int> temp;
        for (auto j : i)
        {
            if (minmoves < k)
            {
                cout << 1 << " " << j + 1 << endl;
                minmoves++;
            }
            else
                temp.push_back(j);
        }
        if (!temp.empty())
        {
            cout << temp.size() << " ";
            for (auto j : temp)
            {
                cout << j + 1 << " ";
            }
            cout << endl;
        }
        else
            minmoves--;
    }
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define N 3005
#define mp make_pair
#define v vector
#define pb push_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define UN(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
string s;
ll n, k;
v<v<ll>> ans(3000003);
v<ll> ind(N);
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> k;
    cin >> s;
    ll temp1 = k;
    ll counter = 0, c1 = 0;
    ll maxmoves = 0, minmoves = 0;
    for (ll i = 0; i < n; i++)
    {
        if (s[i] == 'L')
        {
            counter++;
            maxmoves += i - counter + 1;
            if (i != counter - 1)
            {
                c1++;
                ind[i] = counter - 1;
            }
            minmoves = max(minmoves, i - counter + 1);
        }
    }
    if (k < minmoves || k > maxmoves)
    {
        cout << -1 << endl;
        return 0;
    }
    ll moves = 0;
    // cout << maxmoves << " " << minmoves << endl;
    while (maxmoves != k)
    {
        moves++;
        k--;
        if (maxmoves - c1 > k)
        {
            ans[moves].pb(c1);
            for (ll i = 1; i < n; i++)
            {
                if (s[i] == 'L' && s[i - 1] == 'R')
                {
                    ans[moves].pb(i - 1);
                    s[i] = 'R';
                    s[i - 1] = 'L';
                    ind[i - 1] = ind[i];
                    ind[i] = 0;
                    if (ind[i - 1] == i - 1)
                        c1--;
                }
            }
            maxmoves -= c1;
        }
        else
        {
            ans[moves].pb(maxmoves - k);
            ll c2 = 0;
            for (ll i = 1; i < n && (c2 < maxmoves - k); i++)
            {
                if (s[i] == 'L' && s[i - 1] == 'R')
                {
                    ans[moves].pb(i - 1);
                    s[i] = 'R';
                    s[i - 1] = 'L';
                    ind[i - 1] = ind[i];
                    ind[i] = 0;
                    if (ind[i - 1] == i - 1)
                        c1--;
                    c2++;
                }
            }
            maxmoves = k;
        }
        // cout << s << endl;
    }
    for (ll i = 1; i < n; i++)
    {
        if (s[i] == 'L' && s[i - 1] == 'R')
        {
            ll temp = ind[i];
            for (ll j = i - 1; j >= temp; j--)
            {
                ans[++moves].pb(1);
                ans[moves].pb(j);
                // cout << j << " " << moves << endl;
            }
        }
    }
    // cout << sendl;
    for (ll i = 1; i <= temp1; i++)
    {
        // cout << i << " ";
        for (ll j = 0; j < ans[i].size(); j++)
        {
            if (j >= 1)
                cout << ans[i][j] + 1 << " ";
            else
                cout << ans[i][j] << " ";
        }
        cout << endl;
    }
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long double ld;
#define N 3005
#define mp make_pair
#define v vector
#define pb push_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define UN(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
string s;
ll n, k;
v<v<ll>> ans(3000004);
v<ll> ind(N);
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> k;
    cin >> s;
    ll temp1 = k;
    ll counter = 0, c1 = 0;
    ll maxmoves = 0, minmoves = 0, lastind = 0, moves = 0;
    for (ll i = 0; i < n; i++)
    {
        if (s[i] == 'L')
        {
            counter++;
            maxmoves += i - counter + 1;
            if (i != counter - 1)
            {
                ind[i] = counter - 1;
                minmoves = max(minmoves + 1, i - counter + 1);
                lastind = i;
            }
        }
    }
    // cout << maxmoves << " " << minmoves << endl;

    if (k < minmoves || k > maxmoves)
    {
        cout << -1 << endl;
        return 0;
    }
    for (ll i = 1; i < n; i++)
    {
        if (s[i] == 'L' && s[i - 1] == 'R')
        {
            c1++;
        }
    }
    while (maxmoves != k)
    {
        moves++;
        k--;
        string s1 = s;
        if (maxmoves - c1 > k)
        {
            ans[moves].pb(c1);
            for (ll i = 1; i < n; i++)
            {
                if (s1[i] == 'L' && s1[i - 1] == 'R')
                {
                    ans[moves].pb(i - 1);
                    s[i] = 'R';
                    s[i - 1] = 'L';
                }
            }
            maxmoves -= c1;
        }
        else
        {
            ans[moves].pb(maxmoves - k);
            ll c2 = 0;
            for (ll i = 1; i < n && (c2 < maxmoves - k); i++)
            {
                if (s1[i] == 'L' && s1[i - 1] == 'R')
                {
                    ans[moves].pb(i - 1);
                    s[i] = 'R';
                    s[i - 1] = 'L';
                    c2++;
                }
            }
            maxmoves = k;
        }
        c1 = 0;
        for (ll i = 1; i < n; i++)
        {
            if (s[i] == 'L' && s[i - 1] == 'R')
            {
                c1++;
            }
        }
        // cout << s << endl;
    }
    counter = s[0] == 'L' ? 1 : 0;
    for (ll i = 1; i < n; i++)
    {
        if (s[i] == 'L')
            counter++;
        if (s[i] == 'L' && s[i - 1] == 'R')
        {
            ll temp = counter;
            s[i] = 'R';
            s[temp - 1] = 'L';
            for (ll j = i - 1; j >= temp - 1; j--)
            {
                ans[++moves].pb(1);
                ans[moves].pb(j);
                // cout << j << " " << moves << endl;
            }
        }
    }
    // cout << s<<endl;
    for (ll i = 1; i <= temp1; i++)
    {
        // cout << i << " ";
        for (ll j = 0; j < ans[i].size(); j++)
        {
            if (j >= 1)
                cout << ans[i][j] + 1 << " ";
            else
                cout << ans[i][j] << " ";
        }
        cout << endl;
    }
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long double ld;
#define N 3005
#define mp make_pair
#define v vector
#define pb push_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define UN(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
string s;
ll n, k;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> k;
    cin >> s;
    ll temp1 = k;
    ll counter = 0, c1 = 0;
    ll maxmoves = 0, minmoves = 0, lastind = 0, moves = 0;
    for (ll i = 0; i < n; i++)
    {
        if (s[i] == 'L')
        {
            counter++;
            maxmoves += i - counter + 1;
            if (i != counter - 1)
            {
                minmoves = max(minmoves + 1, i - counter + 1);
                lastind = i;
            }
        }
    }
    // cout << maxmoves << " " << minmoves << endl;

    if (k < minmoves || k > maxmoves)
    {
        cout << -1 << endl;
        return 0;
    }
    for (ll i = 1; i < n; i++)
    {
        if (s[i] == 'L' && s[i - 1] == 'R')
        {
            c1++;
        }
    }
    while (maxmoves != k)
    {
        k--;
        string s1 = s;
        if (maxmoves - c1 > k)
        {
            cout << c1 << " ";
            for (ll i = 1; i < n; i++)
            {
                if (s1[i] == 'L' && s1[i - 1] == 'R')
                {
                    cout << i << " ";
                    s[i] = 'R';
                    s[i - 1] = 'L';
                }
            }
            cout << endl;
            maxmoves -= c1;
        }
        else
        {
            cout << maxmoves - k << " ";
            ll c2 = 0;
            for (ll i = 1; i < n && (c2 < maxmoves - k); i++)
            {
                if (s1[i] == 'L' && s1[i - 1] == 'R')
                {
                    cout << i << " ";
                    s[i] = 'R';
                    s[i - 1] = 'L';
                    c2++;
                }
            }
            cout << endl;
            maxmoves = k;
            break;
        }
        c1 = 0;
        for (ll i = 1; i < n; i++)
        {
            if (s[i] == 'L' && s[i - 1] == 'R')
            {
                c1++;
            }
        }
        // cout << s << endl;
    }
    counter = s[0] == 'L' ? 1 : 0;
    for (ll i = 1; i < n; i++)
    {
        if (s[i] == 'L')
            counter++;
        if (s[i] == 'L' && s[i - 1] == 'R')
        {
            ll temp = counter;
            s[i] = 'R';
            s[temp - 1] = 'L';
            for (ll j = i - 1; j >= temp - 1; j--)
            {
                cout << 1 << " ";
                cout << j + 1 << endl;
            }
        }
    }
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long double ld;
#define N 3005
#define mp make_pair
#define v vector
#define pb push_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define UN(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
string s;
ll n, k;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> k;
    cin >> s;
    ll temp1 = k;
    ll counter = 0, c1 = 0;
    ll maxmoves = 0, minmoves = 0, lastind = 0, moves = 0;
    for (ll i = 0; i < n; i++)
    {
        if (s[i] == 'L')
        {
            counter++;
            maxmoves += i - counter + 1;
            if (i != counter - 1)
            {
                minmoves = max(minmoves + 1, i - counter + 1);
                lastind = i;
            }
        }
    }
    // cout << maxmoves << " " << minmoves << "\n";

    if (k < minmoves || k > maxmoves)
    {
        cout << -1 << "\n";
        return 0;
    }
    for (ll i = 1; i < n; i++)
    {
        if (s[i] == 'L' && s[i - 1] == 'R')
        {
            c1++;
        }
    }
    while (maxmoves != k)
    {
        k--;
        string s1 = s;
        if (maxmoves - c1 > k)
        {
            cout << c1 << " ";
            for (ll i = 1; i < n; i++)
            {
                if (s1[i] == 'L' && s1[i - 1] == 'R')
                {
                    cout << i << " ";
                    s[i] = 'R';
                    s[i - 1] = 'L';
                }
            }
            cout << "\n";
            maxmoves -= c1;
        }
        else
        {
            cout << maxmoves - k << " ";
            ll c2 = 0;
            for (ll i = 1; i < n && (c2 < maxmoves - k); i++)
            {
                if (s1[i] == 'L' && s1[i - 1] == 'R')
                {
                    cout << i << " ";
                    s[i] = 'R';
                    s[i - 1] = 'L';
                    c2++;
                }
            }
            cout << "\n";
            maxmoves = k;
            break;
        }
        c1 = 0;
        for (ll i = 1; i < n; i++)
        {
            if (s[i] == 'L' && s[i - 1] == 'R')
            {
                c1++;
            }
        }
        // cout << s << "\n";
    }
    counter = s[0] == 'L' ? 1 : 0;
    for (ll i = 1; i < n; i++)
    {
        if (s[i] == 'L')
            counter++;
        if (s[i] == 'L' && s[i - 1] == 'R')
        {
            ll temp = counter;
            s[i] = 'R';
            s[temp - 1] = 'L';
            for (ll j = i - 1; j >= temp - 1; j--)
            {
                cout << 1 << " ";
                cout << j + 1 << "\n";
            }
        }
    }
}


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

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<vector<int>> res;
    int sum = 0;
    while (true)
    {
        res.push_back(vector<int>());
        for (int i = 0; i < n - 1; i++)
        {
            if (s[i + 1] == 'L' && s[i] == 'R')
            {
                s[i] = 'L';
                s[i + 1] = 'R';
                res.back().push_back(i);
                i++;
            }
        }
        sum += res.back().size();
        if (res.back().empty())
        {
            res.pop_back();
            break;
        }
    }
    if (k < res.size() || k > sum)
    {
        cout << -1;
        exit(0);
    }
    int cur = res.size();
    for (auto &i : res)
    {
        vector<int> last;
        for (int j : i)
        {
            if (cur < k)
            {
                cout << 1 << " " << j + 1 << "\n";
                cur++;
            }
            else
                last.push_back(j);
        }
        if (!last.empty())
        {
            cout << last.size() << " ";
            for (int j : last)
                cout << j + 1 << " ";
            cout << "\n";
        }
        else
            cur--;
    }
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long double ld;
#define N 3005
#define mp make_pair
#define v vector
#define pb push_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define UN(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
string s;
ll n, k;
v<v<ll>> ans;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> k;
    cin >> s;
    ll maxmoves = 0;
    while (true)
    {
        ans.pb(v<ll>());
        for (ll i = 1; i < n; i++)
        {
            if (s[i] == 'L' && s[i - 1] == 'R')
            {
                s[i - 1] = 'L';
                s[i] = 'R';
                ans.back().pb(i - 1);
                maxmoves++;
            }
        }
        if (ans.back().empty())
        {
            ans.pop_back();
            break;
        }
    }
    ll minmoves = ans.size();
    if (k < minmoves || k > maxmoves)
    {
        cout << -1 << endl;
        return 0;
    }
    for (ll i = 0; i < ans.size(); i++)
    {
        v<ll> temp;
        for (ll j = 0; j < ans[i].size(); j++)
        {
            if (minmoves < k)
            {
                cout << 1 << " " << ans[i][j] + 1 << endl;
                minmoves++;
            }
            else
                temp.pb(ans[i][j]);
        }
        if (!temp.empty())
        {
            cout << temp.size() << " ";
            for (ll j = 0; j < temp.size(); j++)
            {
                cout << temp[j] + 1 << " ";
            }
            cout << endl;
        }
        else
            minmoves--;
    }
}


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

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<vector<int>> res;
    int sum = 0;
    while (true)
    {
        res.push_back(vector<int>());
        for (int i = 0; i < n - 1; i++)
        {
            if (s[i + 1] == 'L' && s[i] == 'R')
            {
                s[i] = 'L', s[i + 1] = 'R',
                res.back().push_back(i),
                i++;
            }
        }
        sum += res.back().size();
        if (res.back().empty())
        {
            res.pop_back();
            break;
        }
    }
    if (k < res.size() || k > sum)
        cout << -1, exit(0);
    int cur = res.size();
    for (auto &i : res)
    {
        vector<int> last;
        for (int j : i)
            if (cur < k)
                cout << 1 << " " << j + 1 << "\n", cur++;
            else
                last.push_back(j);
        if (!last.empty())
        {
            cout << last.size() << " ";
            for (int j : last)
                cout << j + 1 << " ";
            cout << "\n";
        }
        else
            cur--;
    }
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long double ld;
#define N 3005
#define mp make_pair
#define v vector
#define pb push_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define UN(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
string s;
ll n, k;
v<v<ll>> ans(3000004);
v<ll> ind(N);
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> k;
    cin >> s;
    ll temp1 = k;
    ll counter = 0, c1 = 0;
    ll maxmoves = 0, minmoves = 0, lastind = 0, moves = 0;
    for (ll i = 0; i < n; i++)
    {
        if (s[i] == 'L')
        {
            counter++;
            maxmoves += i - counter + 1;
            if (i != counter - 1)
            {
                ind[i] = counter - 1;
                minmoves = max(minmoves + 1, i - counter + 1);
                lastind = i;
            }
        }
    }
    // cout << maxmoves << " " << minmoves << endl;

    if (k < minmoves || k > maxmoves)
    {
        cout << -1 << endl;
        return 0;
    }
    for (ll i = 1; i < n; i++)
    {
        if (s[i] == 'L' && s[i - 1] == 'R')
        {
            c1++;
        }
    }
    while (maxmoves != k)
    {
        moves++;
        k--;
        string s1 = s;
        if (maxmoves - c1 > k)
        {
            ans[moves].pb(c1);
            for (ll i = 1; i < n; i++)
            {
                if (s1[i] == 'L' && s1[i - 1] == 'R')
                {
                    ans[moves].pb(i - 1);
                    s[i] = 'R';
                    s[i - 1] = 'L';
                    ind[i - 1] = ind[i];
                    ind[i] = 0;
                }
            }
            maxmoves -= c1;
        }
        else
        {
            ans[moves].pb(maxmoves - k);
            ll c2 = 0;
            for (ll i = 1; i < n && (c2 < maxmoves - k); i++)
            {
                if (s1[i] == 'L' && s1[i - 1] == 'R')
                {
                    ans[moves].pb(i - 1);
                    s[i] = 'R';
                    s[i - 1] = 'L';
                    ind[i - 1] = ind[i];
                    ind[i] = 0;
                    c2++;
                }
            }
            maxmoves = k;
        }
        c1 = 0;
        for (ll i = 1; i < n; i++)
        {
            if (s[i] == 'L' && s[i - 1] == 'R')
            {
                c1++;
            }
        }
        // cout << s << endl;
    }
    for (ll i = 1; i < n; i++)
    {
        if (s[i] == 'L' && s[i - 1] == 'R')
        {
            ll temp = ind[i];
            s[i] = 'R';
            s[temp] = 'L';
            for (ll j = i - 1; j >= temp; j--)
            {
                ans[++moves].pb(1);
                ans[moves].pb(j);
                // cout << j << " " << moves << endl;
            }
        }
    }
    // cout << s<<endl;
    for (ll i = 1; i <= temp1; i++)
    {
        // cout << i << " ";
        for (ll j = 0; j < ans[i].size(); j++)
        {
            if (j >= 1)
                cout << ans[i][j] + 1 << " ";
            else
                cout << ans[i][j] << " ";
        }
        cout << endl;
    }
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define int ll
typedef long double ld;

typedef pair<int,int> pii;
#define x first
#define y second

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    vector<vector<int>> res;
    int sum=0;
    while(true)
    {
        res.push_back(vector<int>());
        for(int i=0;i<n-1;i++)
            if(s[i]=='R'&&s[i+1]=='L')
                s[i]='L',s[i+1]='R',
                res.back().push_back(i),
                i++;
        sum+=res.back().size();
        if(res.back().empty())
        {
            res.pop_back();
            break;
        }
    }
//    cout<<res.size()<<" "<<sum<<"\n";
    if(k<res.size()||k>sum)
        cout<<-1,exit(0);
    int cur=res.size();
    for(auto&v:res)
    {
        vector<int> last;
        for(int x:v)
            if(cur<k)
                cout<<1<<" "<<x+1<<"\n",
                cur++;
            else
                last.push_back(x);
        if(!last.empty())
        {
            cout<<last.size()<<" ";
            for(int x:last)
                cout<<x+1<<" ";
            cout<<"\n";
        }
        else
            cur--;
    }
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define N 3005
#define mp make_pair
#define v vector
#define pb push_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define UN(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
string s;
ll n, k;
v<v<ll>> ans(3000003);
v<ll> ind(N);
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> k;
    cin >> s;
    ll temp1 = k;
    ll counter = 0, c1 = 0;
    ll maxmoves = 0, minmoves = 0, lastind = 0;
    for (ll i = 0; i < n; i++)
    {
        if (s[i] == 'L')
        {
            counter++;
            maxmoves += i - counter + 1;
            if (i != counter - 1)
            {
                ind[i] = counter - 1;
                minmoves = max(minmoves + 1, i - counter + 1);
                lastind = i;
            }
        }
    }
    // cout << maxmoves << " " << minmoves << endl;

    if (k < minmoves || k > maxmoves)
    {
        cout << -1 << endl;
        return 0;
    }
    ll moves = 0;
    for (ll i = 1; i < n; i++)
    {
        if (s[i] == 'L' && s[i - 1] == 'R')
        {
            c1++;
        }
    }
    while (maxmoves != k)
    {
        moves++;
        k--;
        string s1 = s;
        if (maxmoves - c1 > k)
        {
            ans[moves].pb(c1);
            for (ll i = 1; i < n; i++)
            {
                if (s1[i] == 'L' && s1[i - 1] == 'R')
                {
                    ans[moves].pb(i - 1);
                    s[i] = 'R';
                    s[i - 1] = 'L';
                    ind[i - 1] = ind[i];
                    ind[i] = 0;
                }
            }
            maxmoves -= c1;
        }
        else
        {
            ans[moves].pb(maxmoves - k);
            ll c2 = 0;
            for (ll i = 1; i < n && (c2 < maxmoves - k); i++)
            {
                if (s1[i] == 'L' && s1[i - 1] == 'R')
                {
                    ans[moves].pb(i - 1);
                    s[i] = 'R';
                    s[i - 1] = 'L';
                    ind[i - 1] = ind[i];
                    ind[i] = 0;
                    c2++;
                }
            }
            maxmoves = k;
        }
        c1 = 0;
        for (ll i = 1; i < n; i++)
        {
            if (s[i] == 'L' && s[i - 1] == 'R')
            {
                c1++;
            }
        }
        // cout << s << endl;
    }
    for (ll i = 1; i < n; i++)
    {
        if (s[i] == 'L' && s[i - 1] == 'R')
        {
            ll temp = ind[i];
            s[i] = 'R';
            s[temp] = 'L';
            ind[temp] = ind[i];
            ind[i] = 0;
            if (ind[i - 1] == i - 1)
                c1--;
            for (ll j = i - 1; j >= temp; j--)
            {
                ans[++moves].pb(1);
                ans[moves].pb(j);
                // cout << j << " " << moves << endl;
            }
        }
    }
    // cout << sendl;
    for (ll i = 1; i <= temp1; i++)
    {
        // cout << i << " ";
        for (ll j = 0; j < ans[i].size(); j++)
        {
            if (j >= 1)
                cout << ans[i][j] + 1 << " ";
            else
                cout << ans[i][j] << " ";
        }
        cout << endl;
    }
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define N 3005
#define mp make_pair
#define v vector
#define pb push_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define UN(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
string s;
ll n, k;
v<v<ll>> ans(3000003);
v<ll> ind(N);
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> k;
    cin >> s;
    ll temp1 = k;
    ll counter = 0, c1 = 0;
    ll maxmoves = 0, minmoves = 0;
    for (ll i = 0; i < n; i++)
    {
        if (s[i] == 'L')
        {
            counter++;
            maxmoves += i - counter + 1;
            if (i != counter - 1)
            {
                c1++;
                ind[i] = counter - 1;
            }
            minmoves = max(minmoves, i - counter + 1);
        }
    }
    if (k < minmoves || k > maxmoves)
    {
        cout << -1 << endl;
        return 0;
    }
    ll moves = 0;
    // cout << maxmoves << " " << minmoves << endl;
    while (maxmoves != k)
    {
        moves++;
        k--;
        if (maxmoves - c1 > k)
        {
            ans[moves].pb(c1);
            for (ll i = 1; i < n; i++)
            {
                if (s[i] == 'L' && s[i - 1] == 'R')
                {
                    ans[moves].pb(i - 1);
                    s[i] = 'R';
                    s[i - 1] = 'L';
                    ind[i - 1] = ind[i];
                    ind[i] = 0;
                    if (ind[i - 1] == i - 1)
                        c1--;
                }
            }
            maxmoves -= c1;
        }
        else
        {
            ans[moves].pb(maxmoves - k);
            ll c2 = 0;
            for (ll i = 1; i < n && (c2 < maxmoves - k); i++)
            {
                if (s[i] == 'L' && s[i - 1] == 'R')
                {
                    ans[moves].pb(i - 1);
                    s[i] = 'R';
                    s[i - 1] = 'L';
                    ind[i - 1] = ind[i];
                    ind[i] = 0;
                    if (ind[i - 1] == i - 1)
                        c1--;
                    c2++;
                }
            }
            maxmoves = k;
        }
        // cout << s << endl;
    }
    for (ll i = 1; i < n; i++)
    {
        if (s[i] == 'L' && s[i - 1] == 'R')
        {
            ll temp = ind[i];
            for (ll j = temp; j < i; j++)
            {
                ans[++moves].pb(1);
                ans[moves].pb(j);
                // cout << j << " " << moves << endl;
            }
        }
    }
    // cout << sendl;
    for (ll i = 1; i <= temp1; i++)
    {
        // cout << i << " ";
        for (ll j = 0; j < ans[i].size(); j++)
        {
            if (j >= 1)
                cout << ans[i][j] + 1 << " ";
            else
                cout << ans[i][j] << " ";
        }
        cout << endl;
    }
}


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

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<vector<int>> res;
    int sum = 0;
    while (true)
    {
        res.push_back(vector<int>());
        for (int i = 0; i < n - 1; i++)
        {
            if (s[i + 1] == 'L' && s[i] == 'R')
            {
                s[i] = 'L';
                s[i + 1] = 'R';
                res.back().push_back(i);
                i++;
            }
        }
        sum += res.back().size();
        if (res.back().empty())
        {
            res.pop_back();
            break;
        }
    }
    if (k < res.size() || k > sum)
    {
        cout << -1;
        return 0;
    }
    int cur = res.size();
    for (auto &i : res)
    {
        vector<int> last;
        for (int j : i)
        {
            if (cur < k)
            {
                cout << 1 << " " << j + 1 << endl;
                cur++;
            }
            else
                last.push_back(j);
        }
        if (!last.empty())
        {
            cout << last.size() << " ";
            for (int j : last)
                cout << j + 1 << " ";
            cout << endl;
        }
        else
            cur--;
    }
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long double ld;
#define N 3005
#define mp make_pair
#define v vector
#define pb push_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define UN(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
string s;
ll n, k;
v<v<ll>> ans;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> k;
    cin >> s;
    ll maxmoves = 0;
    while (true)
    {
        ans.pb(v<ll>());
        for (ll i = 1; i < n; i++)
        {
            if (s[i] == 'L' && s[i - 1] == 'R')
            {
                s[i - 1] = 'L';
                s[i] = 'R';
                ans.back().pb(i - 1);
                i++;
            }
        }
        maxmoves += ans.back().size();
        if (ans.back().empty())
        {
            ans.pop_back();
            break;
        }
    }
    ll minmoves = ans.size();
    if (k < minmoves || k > maxmoves)
    {
        cout << -1 << endl;
        return 0;
    }
    for (ll i = 0; i < ans.size(); i++)
    {
        v<ll> temp;
        for (ll j = 0; j < ans[i].size(); j++)
        {
            if (minmoves < k)
            {
                cout << 1 << " " << ans[i][j] + 1 << endl;
                minmoves++;
            }
            else
                temp.pb(ans[i][j]);
        }
        if (!temp.empty())
        {
            cout << temp.size() << " ";
            for (ll j = 0; j < temp.size(); j++)
            {
                cout << temp[j] + 1 << " ";
            }
            cout << endl;
        }
        else
            minmoves--;
    }
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long double ld;
#define N 3005
#define mp make_pair
#define v vector
#define pb push_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define UN(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
string s;
ll n, k;
v<v<ll>> ans;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> k;
    cin >> s;
    ll maxmoves = 0;
    while (true)
    {
        ans.pb(v<ll>());
        for (ll i = 1; i < n; i++)
        {
            if (s[i] == 'L' && s[i - 1] == 'R')
            {
                s[i - 1] = 'L';
                s[i] = 'R';
                ans.back().pb(i - 1);
            }
        }
        maxmoves += ans.back().size();
        if (ans.back().empty())
        {
            ans.pop_back();
            break;
        }
    }
    ll minmoves = ans.size();
    if (k < minmoves || k > maxmoves)
    {
        cout << -1 << endl;
        return 0;
    }
    for (ll i = 0; i < ans.size(); i++)
    {
        v<ll> temp;
        for (ll j = 0; j < ans[i].size(); j++)
        {
            if (minmoves < k)
            {
                cout << 1 << " " << ans[i][j] + 1 << endl;
                minmoves++;
            }
            else
                temp.pb(ans[i][j]);
        }
        if (!temp.empty())
        {
            cout << temp.size() << " ";
            for (ll j = 0; j < temp.size(); j++)
            {
                cout << temp[j] + 1 << " ";
            }
            cout << endl;
        }
        else
            minmoves--;
    }
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long double ld;
#define N 3005
#define mp make_pair
#define v vector
#define pb push_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define UN(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
string s;
ll n, k;
v<v<ll>> ans(3000004);
v<ll> ind(N);
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> k;
    cin >> s;
    ll temp1 = k;
    ll counter = 0, c1 = 0;
    ll maxmoves = 0, minmoves = 0, lastind = 0, moves = 0;
    for (ll i = 0; i < n; i++)
    {
        if (s[i] == 'L')
        {
            counter++;
            maxmoves += i - counter + 1;
            if (i != counter - 1)
            {
                ind[i] = counter - 1;
                minmoves = max(minmoves + 1, i - counter + 1);
                lastind = i;
            }
        }
    }
    // cout << maxmoves << " " << minmoves << endl;

    if (k < minmoves || k > maxmoves)
    {
        cout << -1 c2 << endl;
        return 0;
    }
    for (ll i = 1; i < n; i++)
    {
        if (s[i] == 'L' && s[i - 1] == 'R')
        {
            c1++;
        }
    }
    while (maxmoves != k)
    {
        moves++;
        k--;
        string s1 = s;
        if (maxmoves - c1 > k)
        {
            ans[moves].pb(c1);
            for (ll i = 1; i < n; i++)
            {
                if (s1[i] == 'L' && s1[i - 1] == 'R')
                {
                    ans[moves].pb(i - 1);
                    s[i] = 'R';
                    s[i - 1] = 'L';
                    ind[i - 1] = ind[i];
                    ind[i] = 0;
                }
            }
            maxmoves -= c1;
        }
        else
        {
            ans[moves].pb(maxmoves - k);
            ll c2 = 0;
            for (ll i = 1; i < n && (c2 < maxmoves - k); i++)
            {
                if (s1[i] == 'L' && s1[i - 1] == 'R')
                {
                    ans[moves].pb(i - 1);
                    s[i] = 'R';
                    s[i - 1] = 'L';
                    ind[i - 1] = ind[i];
                    ind[i] = 0;
                    c2++;
                }
            }
            maxmoves = k;
        }
        c1 = 0;
        for (ll i = 1; i < n; i++)
        {
            if (s[i] == 'L' && s[i - 1] == 'R')
            {
                c1++;
            }
        }
        // cout << s << endl;
    }
    for (ll i = 1; i < n; i++)
    {
        if (s[i] == 'L' && s[i - 1] == 'R')
        {
            ll temp = ind[i];
            s[i] = 'R';
            s[temp] = 'L';
            for (ll j = i - 1; j >= temp; j--)
            {
                ans[++moves].pb(1);
                ans[moves].pb(j);
                // cout << j << " " << moves << endl;
            }
        }
    }
    // cout << s<<endl;
    for (ll i = 1; i <= temp1; i++)
    {
        // cout << i << " ";
        for (ll j = 0; j < ans[i].size(); j++)
        {
            if (j >= 1)
                cout << ans[i][j] + 1 << " ";
            else
                cout << ans[i][j] << " ";
        }
        cout << endl;
    }
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long double ld;
#define N 3005
#define mp make_pair
#define v vector
#define pb push_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define UN(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
string s;
ll n, k;
v<v<ll>> ans;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> k;
    cin >> s;
    ll maxmoves = 0;
    while (true)
    {
        ans.pb(v<ll>());
        for (ll i = 1; i < n; i++)
        {
            if (s[i] == 'L' && s[i - 1] == 'R')
            {
                s[i - 1] = 'L';
                s[i] = 'R';
                ans.back().pb(i - 1);
                i++;
            }
        }
        maxmoves += ans.back().size();
        if (ans.back().empty())
        {
            ans.pop_back();
            break;
        }
    }
    ll minmoves = ans.size();
    if (k < minmoves || k > maxmoves)
    {
        cout << -1 << endl;
        return 0;
    }
    for (auto i : ans)
    {
        v<ll> temp;
        for (auto j : i)
        {
            if (minmoves < k)
            {
                cout << 1 << " " << j + 1 << endl;
                minmoves++;
            }
            else
                temp.pb(j);
        }
        if (!temp.empty())
        {
            cout << temp.size() << " ";
            for (auto j : temp)
            {
                cout << j + 1 << " ";
            }
            cout << endl;
        }
        else
            minmoves--;
    }
}


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

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<vector<int>> res;
    int sum = 0;
    while (true)
    {
        res.push_back(vector<int>());
        for (int i = 0; i < n - 1; i++)
        {
            if (s[i + 1] == 'L' && s[i] == 'R')
            {
                s[i] = 'L';
                s[i + 1] = 'R';
                res.back().push_back(i);
                i++;
            }
        }
        sum += res.back().size();
        if (res.back().empty())
        {
            res.pop_back();
            break;
        }
    }
    if (k < res.size() || k > sum)
    {
        cout << -1;
        return 0;
    }
    int cur = res.size();
    for (auto &i : res)
    {
        vector<int> last;
        for (int j : i)
        {
            if (cur < k)
            {
                cout << 1 << " " << j + 1 << "\n";
                cur++;
            }
            else
                last.push_back(j);
        }
        if (!last.empty())
        {
            cout << last.size() << " ";
            for (int j : last)
                cout << j + 1 << " ";
            cout << "\n";
        }
        else
            cur--;
    }
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define N 3005
#define mp make_pair
#define v vector
#define pb push_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define UN(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
string s;
ll n, k;
v<v<ll>> ans(3000003);
v<ll> ind(N);
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> k;
    cin >> s;
    ll temp1 = k;
    ll counter = 0, c1 = 0;
    ll maxmoves = 0, minmoves = 0;
    for (ll i = 0; i < n; i++)
    {
        if (s[i] == 'L')
        {
            counter++;
            maxmoves += i - counter + 1;
            if (i != counter - 1)
            {
                c1++;
                ind[i] = counter - 1;
            }
            minmoves = max(minmoves, i - counter + 1);
        }
    }
    if (k < minmoves || k > maxmoves)
    {
        cout << -1 << endl;
        return 0;
    }
    ll moves = 0;
    // cout << maxmoves << " " << minmoves << endl;
    while (maxmoves != k)
    {
        moves++;
        k--;
        if (maxmoves - c1 > k)
        {
            ans[moves].pb(c1);
            for (ll i = 1; i < n; i++)
            {
                if (s[i] == 'L' && s[i - 1] == 'R')
                {
                    ans[moves].pb(i - 1);
                    s[i] = 'R';
                    s[i - 1] = 'L';
                    ind[i - 1] = ind[i];
                    ind[i] = 0;
                    if (ind[i - 1] == i - 1)
                        c1--;
                }
            }
            maxmoves -= c1;
        }
        else
        {
            ans[moves].pb(maxmoves - k);
            ll c2 = 0;
            for (ll i = 1; i < n && (c2 < maxmoves - k); i++)
            {
                if (s[i] == 'L' && s[i - 1] == 'R')
                {
                    ans[moves].pb(i - 1);
                    s[i] = 'R';
                    s[i - 1] = 'L';
                    ind[i - 1] = ind[i];
                    ind[i] = 0;
                    if (ind[i - 1] == i - 1)
                        c1--;
                    c2++;
                }
            }
            maxmoves = k;
        }
        // cout << s << endl;
    }
    for (ll i = 1; i < n; i++)
    {
        if (s[i] == 'L' && s[i - 1] == 'R')
        {
            ll temp = ind[i];
            s[i] = 'R';
            s[temp] = 'L';
            ind[temp] = ind[i];
            ind[i] = 0;
            if (ind[i - 1] == i - 1)
                c1--;
            for (ll j = i - 1; j >= temp; j--)
            {
                ans[++moves].pb(1);
                ans[moves].pb(j);
                // cout << j << " " << moves << endl;
            }
        }
    }
    // cout << sendl;
    for (ll i = 1; i <= temp1; i++)
    {
        // cout << i << " ";
        for (ll j = 0; j < ans[i].size(); j++)
        {
            if (j >= 1)
                cout << ans[i][j] + 1 << " ";
            else
                cout << ans[i][j] << " ";
        }
        cout << endl;
    }
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long double ld;
#define N 3005
#define mp make_pair
#define v vector
#define pb push_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define UN(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
string s;
ll n, k;
v<v<ll>> ans(3000003);
v<ll> ind(N);
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> k;
    cin >> s;
    ll temp1 = k;
    ll counter = 0, c1 = 0;
    ll maxmoves = 0, minmoves = 0, lastind = 0, moves = 0;
    for (ll i = 0; i < n; i++)
    {
        if (s[i] == 'L')
        {
            counter++;
            maxmoves += i - counter + 1;
            if (i != counter - 1)
            {
                ind[i] = counter - 1;
                minmoves = max(minmoves + 1, i - counter + 1);
                lastind = i;
            }
        }
    }
    // cout << maxmoves << " " << minmoves << endl;

    if (k < minmoves || k > maxmoves)
    {
        cout << -1 << endl;
        return 0;
    }
    for (ll i = 1; i < n; i++)
    {
        if (s[i] == 'L' && s[i - 1] == 'R')
        {
            c1++;
        }
    }
    while (maxmoves != k)
    {
        moves++;
        k--;
        string s1 = s;
        if (maxmoves - c1 > k)
        {
            ans[moves].pb(c1);
            for (ll i = 1; i < n; i++)
            {
                if (s1[i] == 'L' && s1[i - 1] == 'R')
                {
                    ans[moves].pb(i - 1);
                    s[i] = 'R';
                    s[i - 1] = 'L';
                    ind[i - 1] = ind[i];
                    ind[i] = 0;
                }
            }
            maxmoves -= c1;
        }
        else
        {
            ans[moves].pb(maxmoves - k);
            ll c2 = 0;
            for (ll i = 1; i < n && (c2 < maxmoves - k); i++)
            {
                if (s1[i] == 'L' && s1[i - 1] == 'R')
                {
                    ans[moves].pb(i - 1);
                    s[i] = 'R';
                    s[i - 1] = 'L';
                    ind[i - 1] = ind[i];
                    ind[i] = 0;
                    c2++;
                }
            }
            maxmoves = k;
        }
        c1 = 0;
        for (ll i = 1; i < n; i++)
        {
            if (s[i] == 'L' && s[i - 1] == 'R')
            {
                c1++;
            }
        }
        // cout << s << endl;
    }
    for (ll i = 1; i < n; i++)
    {
        if (s[i] == 'L' && s[i - 1] == 'R')
        {
            ll temp = ind[i];
            s[i] = 'R';
            s[temp] = 'L';
            ind[temp] = ind[i];
            ind[i] = 0;
            if (ind[i - 1] == i - 1)
                c1--;
            for (ll j = i - 1; j >= temp; j--)
            {
                ans[++moves].pb(1);
                ans[moves].pb(j);
                // cout << j << " " << moves << endl;
            }
        }
    }
    // cout << s<<endl;
    for (ll i = 1; i <= temp1; i++)
    {
        // cout << i << " ";
        for (ll j = 0; j < ans[i].size(); j++)
        {
            if (j >= 1)
                cout << ans[i][j] + 1 << " ";
            else
                cout << ans[i][j] << " ";
        }
        cout << endl;
    }
}


#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://codeforces.com/problemset/problem/1333/D>
 問題文============================================================
 D. Challenges in school №41
 =================================================================
 解説=============================================================
 ================================================================
 */

vector<int> find_steps(const vector<int>& a,int n) {
    vector<int> steps;
    for (int i = 0; i < n - 1; ++i) {
        if (a[i] == 1 && a[i + 1] == 0) steps.push_back(i);
    }
    return steps;
}

template<class Type>
Type solve(Type res = Type()){
    int n,k; cin >> n >> k;
    string s; cin >> s;
    vector<int> a(n);
    for(int i = 0; i < n;i++){
        a[i] = (s[i] == 'L')?0:1;
    }

    int min_move = 0,max_move = 0;
    int cnt = 0;
    int pre = -1;
    for(int i = n-1; i >= 0; i--){
        if(a[i] == 0){
            cnt++;
        }else{
            max_move += cnt;
            min_move = max(cnt,pre+1);
            pre = min_move;
        }
    }
    if(k < min_move || k > max_move){
        cout << -1 << endl;
        return 0;
    }

    bool flag = false;
    vector<int> steps;
    for(int i = 0; i < k;i++){
        if(flag){
            int val = steps.back();
            steps.pop_back();
            cout << "1 " << val+1;
            a[val  ] = 0;
            a[val+1] = 1;
            if(val > 0 && a[val-1] == 1){
                steps.push_back(val-1);
            }
            if(val + 2 < n && a[val+2] == 0){
                steps.push_back(val+1);
            }
        }else{
            vector<int> tsteps = find_steps(a,n);
            cout << min((int)(tsteps.size()),max_move-k+i+1) << " ";

            int cur = 0;
            while(k - i - 1 < max_move && cur < tsteps.size()){
                cout << tsteps[cur] + 1 << " ";
                a[tsteps[cur]] = 0;
                a[tsteps[cur]+1] = 1;
                cur++;
                max_move--;
            }
            if(max_move == k - i - 1){
                flag = true;
                steps = find_steps(a,n);
            }
        }
        cout << endl;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve(0);
    // cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://codeforces.com/problemset/problem/1333/D>
 問題文============================================================
 D. Challenges in school №41
 =================================================================
 解説=============================================================
 ================================================================
 */

vector<int> find_steps(const vector<int>& a,int n) {
    vector<int> steps;
    for (int i = 0; i < n - 1; ++i) {
        if (a[i] == 1 && a[i + 1] == 0) steps.push_back(i);
    }
    return steps;
}

template<class Type>
Type solve(Type res = Type()){
    int n,k; cin >> n >> k;
    string s; cin >> s;
    vector<int> a(n);
    for(int i = 0; i < n;i++){
        a[i] = (s[i] == 'L')?0:1;
    }

    int min_move = 0,max_move = 0;
    int cnt = 0;
    int pre = -1;
    for(int i = n-1; i >= 0; i--){
        if(a[i] == 0){
            cnt++;
        }else{
            max_move += cnt;
            min_move = max(cnt,pre+1);
            pre = min_move;
        }
    }
    if(k < min_move || k > max_move){
        cout << -1 << endl;
        return 0;
    }

    bool flag = false;
    vector<int> steps;
    for(int i = 0; i < k;i++){
        if(flag){
            int val = steps.back();
            steps.pop_back();
            cout << "1 " << val+1;
            a[val  ] = 0;
            a[val+1] = 1;
            if(val > 0 && a[val-1] == 1){
                steps.push_back(val-1);
            }
            if(val + 2 < n && a[val+2] == 0){
                steps.push_back(val+1);
            }
        }else{
            auto tsteps = find_steps(a,n);
            cout << min((int)(tsteps.size()),max_move-k+i+1) << " ";

            int cur = 0;
            while(k - i - 1 < max_move && cur < tsteps.size()){
                cout << tsteps[cur] + 1 << " ";
                a[tsteps[cur]] = 0;
                a[tsteps[cur]+1] = 1;
                cur++;
                max_move--;
            }
            if(max_move == k - i - 1){
                flag = true;
                steps = find_steps(a,n);
            }
        }
        cout << endl;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve(0);
    // cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://codeforces.com/problemset/problem/1333/D>
 問題文============================================================
 D. Challenges in school №41
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    int n,k; cin >> n >> k;
    string s; cin >> s;
    for(auto& c:s) c = (c=='L')?0:1;

    int min_move = 0,max_move = 0;
    int cnt = 0;
    int pre = -1;
    for(int i = n-1; i >= 0; i--){
        if(s[i] == 0){
            cnt++;
        }else{
            max_move += cnt;
            min_move = max(cnt,pre+1);
            pre = min_move;
        }
    }
    if(k < min_move || k > max_move){
        cout << -1 << endl;
        return 0;
    }

    bool flag = false;
    vector<int> steps;
    for(int i = 0; i < k;i++){
        if(flag){
            int val = steps.back();
            steps.pop_back();
            cout << "1 " << val+1;
            s[val  ] = 0;
            s[val+1] = 1;
            if(val > 0 && s[val-1] == 1){
                steps.push_back(val-1);
            }
            if(val + 2 < n && s[val+2] == 0){
                steps.push_back(val+1);
            }
        }else{
            vector<int> tsteps;
            for(int i = 0; i < n-1;i++){
                if(s[i] == 1 && s[i+1] == 0) tsteps.push_back(i);
            }
            cout << min((int)(tsteps.size()),max_move-k+i+1) << " ";

            int cur = 0;
            while(k - i - 1 < max_move && cur < tsteps.size()){
                cout << tsteps[cur] + 1 << " ";
                s[tsteps[cur]] = 0;
                s[tsteps[cur]+1] = 1;
                cur++;
                max_move--;
            }
            if(max_move == k - i - 1){
                flag = true;
                vector<int> ttsteps;
                for(int i = 0; i < n-1;i++){
                    if(s[i] == 1 && s[i+1] == 0) ttsteps.push_back(i);
                }
                steps = ttsteps;
            }
        }
        cout << "\n";
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve(0);
    // cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://codeforces.com/problemset/problem/1333/D>
 問題文============================================================
 D. Challenges in school №41
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    int n,k; cin >> n >> k;
    string s; cin >> s;
    for(auto& c:s) c = (c=='L')?0:1;

    int min_move = 0,max_move = 0;
    int cnt = 0;
    int pre = -1;
    for(int i = n-1; i >= 0; i--){
        if(s[i] == 0){
            cnt++;
        }else{
            max_move += cnt;
            min_move = max(cnt,pre+1);
            pre = min_move;
        }
    }
    if(k < min_move || k > max_move){
        cout << -1 << endl;
        return 0;
    }

    bool flag = false;
    vector<int> steps;
    for(int i = 0; i < k;i++){
        if(flag){
            int val = steps.back();
            steps.pop_back();
            cout << "1 " << val+1;
            s[val  ] = 0;
            s[val+1] = 1;
            if(val > 0 && s[val-1] == 1){
                steps.push_back(val-1);
            }
            if(val + 2 < n && s[val+2] == 0){
                steps.push_back(val+1);
            }
        }else{
            vector<int> tsteps;
            for(int i = 0; i < n-1;i++){
                if(s[i] == 1 && s[i+1] == 0) tsteps.push_back(i);
            }
            cout << min((int)(tsteps.size()),max_move-k+i+1) << " ";

            int cur = 0;
            while(k - i - 1 < max_move && cur < tsteps.size()){
                cout << tsteps[cur] + 1 << " ";
                s[tsteps[cur]] = 0;
                s[tsteps[cur]+1] = 1;
                cur++;
                max_move--;
            }
            if(max_move == k - i - 1){
                flag = true;
                vector<int> ttsteps;
                for(int i = 0; i < n-1;i++){
                    if(s[i] == 1 && s[i+1] == 0) ttsteps.push_back(i);
                }
                steps = ttsteps;
            }
        }
        cout << endl;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve(0);
    // cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://codeforces.com/problemset/problem/1333/D>
 問題文============================================================
 D. Challenges in school №41
 =================================================================
 解説=============================================================
 ================================================================
 */

vector<int> find_steps(const vector<int>& a) {
    vector<int> steps;
    int n = (int) a.size();
    for (int i = 0; i < n - 1; ++i) {
        if (a[i] == 1 && a[i + 1] == 0) steps.push_back(i);
    }
    return steps;
}

template<class Type>
Type solve(Type res = Type()){
    int n,k; cin >> n >> k;
    string s; cin >> s;
    vector<int> a(n);
    for(int i = 0; i < n;i++){
        a[i] = (s[i] == 'L')?0:1;
    }

    int min_move = 0,max_move = 0;
    int cnt = 0;
    int pre = -1;
    for(int i = n-1; i >= 0; i--){
        if(a[i] == 0){
            cnt++;
        }else{
            max_move += cnt;
            min_move = max(cnt,pre+1);
            pre = min_move;
        }
    }
    if(k < min_move || k > max_move){
        cout << -1 << endl;
        return 0;
    }

    bool flag = false;
    vector<int> now_steps;
    for(int i = 0; i < k;i++){
        if(flag){
            int v = now_steps.back();
            now_steps.pop_back();
            cout << "1 " << v + 1;
            a[v] = 0;
            a[v + 1] = 1;
            if (v > 0 && a[v - 1] == 1) {
                now_steps.push_back(v - 1);
            }
            if (v + 2 < n && a[v + 2] == 0) {
                now_steps.push_back(v + 1);
            }
        }else{
            auto steps = find_steps(a);
            cout << min(int(steps.size()), max_move - k + i + 1) << ' ';
            int cur = 0;
            while (k - i - 1 < max_move && cur < steps.size()) {
                cout << steps[cur] + 1 << ' ';
                a[steps[cur]] = 0;
                a[steps[cur] + 1] = 1;
                cur++;
                max_move--;
            }
            if (max_move == k - i - 1) {
                flag = true;
                now_steps = find_steps(a);
            }
        }
        cout << endl;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve(0);
    // cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://codeforces.com/problemset/problem/1333/D>
 問題文============================================================
 D. Challenges in school №41
 =================================================================
 解説=============================================================
 ================================================================
 */

vector<int> find_steps(const string& s,int n) {
    vector<int> steps;
    for (int i = 0; i < n - 1; ++i) {
        if (s[i] == 1 && s[i + 1] == 0) steps.push_back(i);
    }
    return steps;
}

template<class Type>
Type solve(Type res = Type()){
    int n,k; cin >> n >> k;
    string s; cin >> s;
    for(auto& c:s) c = (c=='L')?0:1;

    int min_move = 0,max_move = 0;
    int cnt = 0;
    int pre = -1;
    for(int i = n-1; i >= 0; i--){
        if(s[i] == 0){
            cnt++;
        }else{
            max_move += cnt;
            min_move = max(cnt,pre+1);
            pre = min_move;
        }
    }
    if(k < min_move || k > max_move){
        cout << -1 << endl;
        return 0;
    }

    bool flag = false;
    vector<int> steps;
    for(int i = 0; i < k;i++){
        if(flag){
            int val = steps.back();
            steps.pop_back();
            cout << "1 " << val+1;
            s[val  ] = 0;
            s[val+1] = 1;
            if(val > 0 && s[val-1] == 1){
                steps.push_back(val-1);
            }
            if(val + 2 < n && s[val+2] == 0){
                steps.push_back(val+1);
            }
        }else{
            vector<int> tsteps = find_steps(s,n);
            cout << min((int)(tsteps.size()),max_move-k+i+1) << " ";

            int cur = 0;
            while(k - i - 1 < max_move && cur < tsteps.size()){
                cout << tsteps[cur] + 1 << " ";
                s[tsteps[cur]] = 0;
                s[tsteps[cur]+1] = 1;
                cur++;
                max_move--;
            }
            if(max_move == k - i - 1){
                flag = true;
                steps = find_steps(s,n);
            }
        }
        cout << endl;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve(0);
    // cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://codeforces.com/problemset/problem/1333/D>
 問題文============================================================
 D. Challenges in school №41
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    int n,k; cin >> n >> k;
    string s; cin >> s;
    for(auto& c:s) c = (c=='L')?0:1;

    int min_move = 0,max_move = 0;
    int cnt = 0;
    int pre = -1;
    for(int i = n-1; i >= 0; i--){
        if(s[i] == 0){
            cnt++;
        }else{
            max_move += cnt;
            min_move = max(cnt,pre+1);
            pre = min_move;
        }
    }
    if(k < min_move || k > max_move){
        cout << -1 << endl;
        return 0;
    }

    bool flag = false;
    vector<int> steps;
    for(int i = 0; i < k;i++){
        if(flag){
            int val = steps.back();
            steps.pop_back();
            cout << "1 " << val+1;
            s[val  ] = 0;
            s[val+1] = 1;
            if(val > 0 && s[val-1] == 1){
                steps.push_back(val-1);
            }
            if(val + 2 < n && s[val+2] == 0){
                steps.push_back(val+1);
            }
        }else{
            vector<int> tsteps;
            for(int i = 0; i < n-1;i++){
                if(s[i] == 1 && s[i+1] == 0) tsteps.push_back(i);
            }
            cout << min((int)(tsteps.size()),max_move-k+i+1) << " ";

            int cur = 0;
            while(k - i - 1 < max_move && cur < tsteps.size()){
                cout << tsteps[cur] + 1 << " ";
                s[tsteps[cur]] = 0;
                s[tsteps[cur]+1] = 1;
                cur++;
                max_move--;
            }
            if(max_move == k - i - 1){
                flag = true;
                vector<int> ttsteps;
                for(int i = 0; i < n-1;i++){
                    if(s[i] == 1 && s[i+1] == 0) ttsteps.push_back(i);
                }
                steps = ttsteps;
            }
        }
        cout << "¥n";
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve(0);
    // cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n, k;

vector<int> find_steps(const vector<int>& a) {
    vector<int> steps;
    for (int i = 0; i < n - 1; ++i) {
        if (a[i] == 1 && a[i + 1] == 0) steps.push_back(i);
    }
    return steps;
}

int main() {
    cin >> n >> k;
    string s; cin >> s;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) a[i] = (s[i] == 'L') ? 0 : 1;
    int maxi = 0, mini = 0;
    int cnt = 0;
    int last = -1;
    for (int i = n - 1; i >= 0; --i) {
        if (a[i] == 0) {
            ++cnt;
        } else {
            if (cnt == 0) continue;
            maxi += cnt;
            mini = max(cnt, last + 1);
            last = mini;
        }
    }
    if (k < mini || k > maxi) {
        cout << -1;
        return 0;
    }
    bool is_min = false;
    vector<int> have_step;
    for (int i = 0; i < k; ++i) {
        if (!is_min) {
            auto steps = find_steps(a);
            cout << min(int(steps.size()), maxi - k + i + 1) << ' ';
            int cur = 0;
            while (k - i - 1 < maxi && cur < steps.size()) {
                cout << steps[cur] + 1 << ' ';
                a[steps[cur]] = 0;
                a[steps[cur] + 1] = 1;
                ++cur;
                --maxi;
            }
            if (maxi == k - i - 1) {
                is_min = true;
                have_step = find_steps(a);
            }
        } else {
            int v = have_step.back();
            have_step.pop_back();
            cout << "1 " << v + 1;
            a[v] = 0;
            a[v + 1] = 1;
            if (v > 0 && a[v - 1] == 1) {
                have_step.push_back(v - 1);
            }
            if (v + 2 < n && a[v + 2] == 0) {
                have_step.push_back(v + 1);
            }
        }
        cout << '\n';
    }
}


#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://codeforces.com/problemset/problem/1333/D>
 問題文============================================================
 D. Challenges in school №41
 =================================================================
 解説=============================================================
 ================================================================
 */

vector<int> find_steps(const vector<int>& a) {
    vector<int> steps;
    int n = (int) a.size();
    for (int i = 0; i < n - 1; ++i) {
        if (a[i] == 1 && a[i + 1] == 0) steps.push_back(i);
    }
    return steps;
}

template<class Type>
Type solve(Type res = Type()){
    int n,k; cin >> n >> k;
    string s; cin >> s;
    vector<int> a(n);
    for(int i = 0; i < n;i++){
        a[i] = (s[i] == 'L')?0:1;
    }

    int min_move = 0,max_move = 0;
    int cnt = 0;
    int pre = -1;
    for(int i = n-1; i >= 0; i--){
        if(a[i] == 0){
            cnt++;
        }else{
            max_move += cnt;
            min_move = max(cnt,pre+1);
            pre = min_move;
        }
    }
    if(k < min_move || k > max_move){
        cout << -1 << endl;
        return 0;
    }

    bool flag = false;
    vector<int> now_steps;
    for(int i = 0; i < k;i++){
        if(flag){
            int val = now_steps.back();
            now_steps.pop_back();
            cout << "1 " << val+1;
            a[val  ] = 0;
            a[val+1] = 1;
            if(val > 0 && a[val-1] == 1){
                now_steps.push_back(val-1);
            }
            if(val + 2 < n && a[val+2] == 0){
                now_steps.push_back(val+1);
            }
        }else{
            auto steps = find_steps(a);
            cout << min(int(steps.size()), max_move - k + i + 1) << ' ';
            int cur = 0;
            while (k - i - 1 < max_move && cur < steps.size()) {
                cout << steps[cur] + 1 << ' ';
                a[steps[cur]] = 0;
                a[steps[cur] + 1] = 1;
                cur++;
                max_move--;
            }
            if (max_move == k - i - 1) {
                flag = true;
                now_steps = find_steps(a);
            }
        }
        cout << endl;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve(0);
    // cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
/* * * *   * * *   	* * * */
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, pair<ll, ll>> pll;
#define ms(a,v) memset(a,v,sizeof a)
/* * * *   * * *   	* * * */
/* *
 *
 * I love Ylva Eriksson
 *
 * */
int ts(char c) {return c == 'L' ? 0: 1;}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, k; cin>>n>>k;
	string s; cin>>s;
	bool move = 1;
	vector<vector<int>> turns;
	while(move){
		move = 0;
		for(int i=0; i+1<n; ){
			if(s[i] == 'R' && s[i+1] == 'L') {
				if(!move) turns.push_back({});
				turns.back().push_back(i+1);
				swap(s[i], s[i+1]);
				move = 1;
				i+=2;
			}else i++;
		}
	}
	int m = turns.size();
	ll sum = 0;
	for(auto i: turns) sum+=i.size();
	if(m > k || sum > k*(n/2) || sum < k){ cout<<-1<<endl; return 0; }
	int left = k - m;
	int idx = 0, last = 0;
	for(int i=0; i<k; ++i){
		if(left){
			cout<<"1 "<<turns[idx][last++]<<endl;
			if(last == turns[idx].size()) last = 0, idx++;
			left--;
		}else{
			cout<<turns[idx].size() - last<<" ";
			for(;last<turns[idx].size(); ++last) cout<<turns[idx][last]<<" ";
			last = 0;
			cout<<endl;
			idx++;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
/* * * *   * * *   	* * * */
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, pair<ll, ll>> pll;
#define ms(a,v) memset(a,v,sizeof a)
/* * * *   * * *   	* * * */
/* *
 *
 * I love Ylva Eriksson
 *
 * */
int ts(char c) {return c == 'L' ? 0: 1;}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, k; cin>>n>>k;
	string s; cin>>s;
	vector<vector<int>> turns;
	ll sum = 0;
	while(1){
		turns.push_back({});
		for(int i=0; i+1<n; ++i){
			if(s[i] == 'R' && s[i+1] == 'L') {
				turns.back().push_back(i+1);
				sum++;
			}
		}
		for(int i : turns.back()) swap(s[i], s[i-1]);
		if(turns.back().empty()) {
			turns.pop_back();
			break;
		}
	}
	int m = turns.size();
	if(m > k || sum > 1ll*k*(1ll*n/2ll) || sum < k){ cout<<-1<<endl; return 0; }
	int left = k - m;
	int idx = 0, last = 0;
	for(int i=0; i<turns.size(); ++i){
		while(turns[i].size() > 1 && k > turns.size()){
			cout<<"1 "<<turns[i].back()<<" ";
			turns[i].pop_back();
			k--;
			cout<<endl;
		}
		cout<<turns[i].size()<<" ";
		for(int j : turns[i]) cout<<j<<" ";
		cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
/* * * *   * * *   	* * * */
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, pair<ll, ll>> pll;
#define ms(a,v) memset(a,v,sizeof a)
/* * * *   * * *   	* * * */
/* *
 *
 * I love Ylva Eriksson
 *
 * */
int ts(char c) {return c == 'L' ? 0: 1;}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, K; cin>>n>>K;
	string s; cin>>s;
	vector<pii> a;
	a.push_back({ts(s[0]), 1});
	for(int i=1; i<n; ++i){
		if(ts(s[i]) == a.back().first) {
			a.back().second++;
		}else {
			a.push_back({ts(s[i]), 1});
		}
	}
	int m = a.size(), idx, last;
	if(a[m-1].first) {
		last = m-2;
		idx = a[m-2].second;
	}else{
		last = m-1;
		idx = 0;
	}
	vector<int> turns;
	for(int i=m-2;i>=0; --i) {
		if(a[i].first){
			int sum = 0;
			for(int j = i+1; j<=last; ++j) {
				sum+=a[j].second;
			}
			for(int j=0, plus = 0;j <sum; ++j, plus++) {
				turns.push_back(n-idx-sum + plus);
			}
			for(int j=0; j<a[i].second-1; ++j){
				for(int k=0, plus = 0; k<sum; k++, plus++) {
					turns.push_back(turns[turns.size() - sum + plus] - 1);
				}
			}
			idx+=a[i].second;
			swap(a[i], a[last]);
			last--;
		}
	}
	m = turns.size();
	if(m < K || m > K*(n/2)){
		cout<<-1<<endl;
		return 0;
	}
	int tot = m/K, add = 0;
	if(m%K) add = m%K;
	cout<<tot+add<<" ";
	for(int i=0; i<tot+add; ++i) cout<<turns[i]<<" ";
	cout<<endl;
	idx = tot+add;
	for(int i=0; i<K-1; ++i){
		cout<<tot<<" ";
		for(int j=0; j<tot; ++j, idx++) cout<<turns[idx]<<" ";
		cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
/* * * *   * * *   	* * * */
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, pair<ll, ll>> pll;
#define ms(a,v) memset(a,v,sizeof a)
/* * * *   * * *   	* * * */
/* *
 *
 * I love Ylva Eriksson
 *
 * */
int ts(char c) {return c == 'L' ? 0: 1;}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, K; cin>>n>>K;
	string s; cin>>s;
	vector<pii> a;
	a.push_back({ts(s[0]), 1});
	for(int i=1; i<n; ++i){
		if(ts(s[i]) == a.back().first) {
			a.back().second++;
		}else {
			a.push_back({ts(s[i]), 1});
		}
	}
	int m = a.size(), idx, last;
	if(a[m-1].first) {
		last = m-2;
		idx = a[m-2].second;
	}else{
		last = m-1;
		idx = 0;
	}
	vector<int> turns;
	for(int i=m-2;i>=0; --i) {
		if(a[i].first){
			int sum = 0;
			for(int j = i+1; j<=last; ++j) {
				sum+=a[j].second;
			}
			for(int j=0, plus = 0;j <sum; ++j, plus++) {
				turns.push_back(n-idx-sum + plus);
			}
			for(int j=0; j<a[i].first-1; ++j){
				for(int k=0, plus = 0; k<sum; k++, plus++) {
					turns.push_back(turns[turns.size() - sum + plus] - 1);
				}
			}
			idx+=a[i].second;
			swap(a[i], a[last]);
			last--;
		}
	}
	m = turns.size();
	if(m < K || m > K*(n/2)){
		cout<<-1<<endl;
		return 0;
	}
	int tot = m/K, add = 0;
	if(m%K) add = m%K;
	cout<<tot+add<<" ";
	for(int i=0; i<tot+add; ++i) cout<<turns[i]<<" ";
	cout<<endl;
	idx = tot+add;
	for(int i=0; i<K-1; ++i){
		cout<<tot<<" ";
		for(int j=0; j<tot; ++j, idx++) cout<<turns[idx]<<" ";
		cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
/* * * *   * * *   	* * * */
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, pair<ll, ll>> pll;
#define ms(a,v) memset(a,v,sizeof a)
/* * * *   * * *   	* * * */
/* *
 *
 * I love Ylva Eriksson
 *
 * */
int ts(char c) {return c == 'L' ? 0: 1;}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, k; cin>>n>>k;
	string s; cin>>s;
	bool move = 1;
	vector<vector<int>> turns;
	while(move){
		move = 0;
		for(int i=0; i+1<n; ){
			if(s[i] == 'R' && s[i+1] == 'L') {
				if(!move) turns.push_back({});
				turns.back().push_back(i+1);
				swap(s[i], s[i+1]);
				move = 1;
				i+=2;
			}else i++;
		}
	}
	int m = turns.size();
	ll sum = 0;
	for(auto i: turns) sum+=i.size();
	if(m > k || sum > k*(n/2) || sum < k){ cout<<-1<<endl; return 0; }
	int left = k - m;
	int idx = 0, last = 0;
	for(int i=0; i<k; ++i){
		if(left){
			cout<<"1 "<<turns[idx][last++]<<endl;
			if(last >= turns[idx].size()) last = 0, idx++;
			left--;
		}else{
			if(m - idx == k - i){
				cout<<turns[idx].size() - last<<" ";
				for(;last<turns[idx].size(); ++last) cout<<turns[idx][last]<<" ";
				cout<<endl;
				last = 0, idx++;
			}else{
				cout<<"1 "<<turns[idx][last++]<<endl;
				if(last >= turns[idx].size()) last = 0, idx++;
			}
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
/* * * *   * * *   	* * * */
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, pair<ll, ll>> pll;
#define ms(a,v) memset(a,v,sizeof a)
/* * * *   * * *   	* * * */
/* *
 *
 * I love Ylva Eriksson
 *
 * */
int ts(char c) {return c == 'L' ? 0: 1;}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, K; cin>>n>>K;
	string s; cin>>s;
	bool move = 1;
	vector<int> turns;
	while(move){
		move = 0;
		for(int i=0; i+1<n; ){
			if(s[i] == 'R' && s[i+1] == 'L') {
				turns.push_back(i+1);
				swap(s[i], s[i+1]);
				move = 1;
				i+=2;
			}else i++;
		}
	}
	int m = turns.size(), idx = 0;
	if(m < K || m > K*(n/2)){ cout<<-1<<endl; return 0; }
	int tot = m/K, add = m%K;
	for(int i=0; i<K; ++i){
		cout<<min(n/2, tot + add)<<" ";
		for(int i=0; i<tot; ++i) cout<<turns[idx++]<<" ";
		for(int i = tot; i<n/2 && add > 0; ++i, add--) cout<<turns[idx++]<<" ";
		cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
/* * * *   * * *   	* * * */
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, pair<ll, ll>> pll;
#define ms(a,v) memset(a,v,sizeof a)
/* * * *   * * *   	* * * */
/* *
 *
 * I love Ylva Eriksson
 *
 * */
int ts(char c) {return c == 'L' ? 0: 1;}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, k; cin>>n>>k;
	string s; cin>>s;
	bool move = 1;
	vector<vector<int>> turns;
	while(move){
		move = 0;
		for(int i=0; i+1<n; ){
			if(s[i] == 'R' && s[i+1] == 'L') {
				if(!move) turns.push_back({});
				turns.back().push_back(i+1);
				swap(s[i], s[i+1]);
				move = 1;
				i+=2;
			}else i++;
		}
	}
	int m = turns.size();
	//cout<<m<<endl;
	if(m > k){ cout<<-1<<endl; return 0; }
	int last = -1, idx = 0;
	if(m < k){
		idx = turns.size() - 1, last = k-1;
		while(turns.size() < k) turns.push_back({});
	}
	while(last>=idx && idx >= 0){
		while(!turns[idx].empty() && last > idx){
			turns[last].push_back(turns[idx].back());
			turns[idx].pop_back();
			last--;
		}
		if(turns[idx].empty()) idx--;
	}
	if(idx < 0) { cout<<-1<<endl; return 0; }
	for(int i=0; i<k; ++i){
		cout<<turns[i].size()<<" ";
		for(int j: turns[i]) cout<<j<<" ";
		cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
/* * * *   * * *   	* * * */
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, pair<ll, ll>> pll;
#define ms(a,v) memset(a,v,sizeof a)
/* * * *   * * *   	* * * */
/* *
 *
 * I love Ylva Eriksson
 *
 * */
int ts(char c) {return c == 'L' ? 0: 1;}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, K; cin>>n>>K;
	string s; cin>>s;
	bool move = 1;
	vector<int> turns;
	while(move){
		move = 0;
		for(int i=0; i+1<n; ++i){
			if(s[i] == 'R' && s[i+1] == 'L') {
				turns.push_back(i+1);
				swap(s[i], s[i+1]);
				move = 1;
			}
		}
	}
	int m = turns.size(), idx = 0;
	if(m < K || m > K*(n/2)){ cout<<-1<<endl; return 0; }
	int tot = m/K, add = m%K;
	for(int i=0; i<K; ++i){
		cout<<min(n/2, tot + add)<<" ";
		for(int i=0; i<tot; ++i) cout<<turns[idx++]<<" ";
		for(int i = tot; i<n/2 && add > 0; ++i, add--) cout<<turns[idx++]<<" ";
		cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
/* * * *   * * *   	* * * */
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, pair<ll, ll>> pll;
#define ms(a,v) memset(a,v,sizeof a)
/* * * *   * * *   	* * * */
/* *
 *
 * I love Ylva Eriksson
 *
 * */
int ts(char c) {return c == 'L' ? 0: 1;}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, k; cin>>n>>k;
	string s; cin>>s;
	bool move = 1;
	vector<vector<int>> turns;
	while(move){
		move = 0;
		for(int i=0; i+1<n; ){
			if(s[i] == 'R' && s[i+1] == 'L') {
				if(!move) turns.push_back({});
				turns.back().push_back(i+1);
				swap(s[i], s[i+1]);
				move = 1;
				i+=2;
			}else i++;
		}
	}
	int m = turns.size();
	ll sum = 0;
	for(auto i: turns) sum+=i.size();
	if(m > k || sum > 1ll*k*(1ll*n/2ll) || sum < k){ cout<<-1<<endl; return 0; }
	int left = k - m;
	int idx = 0, last = 0;
	for(int i=0; i<k; ++i){
		if(left){
			cout<<"1 "<<turns[idx][last++]<<endl;
			if(last >= turns[idx].size()) last = 0, idx++;
			left--;
		}else{
			if(m - idx == k - i){
				cout<<turns[idx].size() - last<<" ";
				for(;last<turns[idx].size(); ++last) cout<<turns[idx][last]<<" ";
				cout<<endl;
				last = 0, idx++;
			}else{
				cout<<"1 "<<turns[idx][last++]<<endl;
				if(last >= turns[idx].size()) last = 0, idx++;
			}
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
/* * * *   * * *   	* * * */
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, pair<ll, ll>> pll;
#define ms(a,v) memset(a,v,sizeof a)
/* * * *   * * *   	* * * */
/* *
 *
 * I love Ylva Eriksson
 *
 * */
int ts(char c) {return c == 'L' ? 0: 1;}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, k; cin>>n>>k;
	string s; cin>>s;
	bool move = 1;
	vector<vector<int>> turns;
	while(move){
		move = 0;
		for(int i=0; i+1<n; ){
			if(s[i] == 'R' && s[i+1] == 'L') {
				if(!move) turns.push_back({});
				turns.back().push_back(i+1);
				swap(s[i], s[i+1]);
				move = 1;
				i+=2;
			}else i++;
		}
	}
	int m = turns.size();
	ll sum = 0;
	for(auto i: turns) sum+=i.size();
	if(m > k || sum > k*(n/2) || sum < k){ cout<<-1<<endl; return 0; }
	int left = k - m;
	int idx = 0, last = 0;
	for(int i=0; i<k; ++i){
		if(left){
			cout<<"1 "<<turns[idx][last++]<<endl;
			if(last == turns[idx].size()) last = 0, idx++;
			left--;
		}else{
			if(i == idx){
				cout<<turns[idx].size() - last<<" ";
				for(;last<turns[idx].size(); ++last) cout<<turns[idx][last]<<" ";
				cout<<endl;
			}else{
				cout<<turns[i].size()<<" ";
				for(int j: turns[i]) cout<<j<<" ";
				cout<<endl;
			}
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
/* * * *   * * *   	* * * */
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, pair<ll, ll>> pll;
#define ms(a,v) memset(a,v,sizeof a)
/* * * *   * * *   	* * * */
/* *
 *
 * I love Ylva Eriksson
 *
 * */
int ts(char c) {return c == 'L' ? 0: 1;}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, K; cin>>n>>K;
	string s; cin>>s;
	vector<pii> a;
	a.push_back({ts(s[0]), 1});
	for(int i=1; i<n; ++i){
		if(ts(s[i]) == a.back().first) {
			a.back().second++;
		}else {
			a.push_back({ts(s[i]), 1});
		}
	}
	int m = a.size(), idx, last;
	if(a[m-1].first) {
		last = m-2;
		idx = a[m-2].second;
	}else{
		last = m-1;
		idx = 0;
	}
	vector<int> turns;
	for(int i=m-2;i>=0; --i) {
		if(a[i].first){
			int sum = 0;
			for(int j = i+1; j<=last; ++j) {
				sum+=a[j].second;
			}
			for(int j=0, plus = 0;j <sum; ++j, plus++) {
				turns.push_back(n-idx-sum + plus);
			}
			for(int j=0; j<a[i].second-1; ++j){
				for(int k=0, plus = 0; k<sum; k++, plus++) {
					turns.push_back(turns[turns.size() - sum + plus] - 1);
				}
			}
			idx+=a[i].second;
			swap(a[i], a[last]);
			last--;
		}
	}
	m = turns.size();
	if(m < K || m > K*(n/2)){
		cout<<-1<<endl;
		return 0;
	}
	idx = 0, last;
	vector<vector<int>> ans(K, vector<int> ());
	for(int i=0; i<K; ++i){
		for(int j=0; j<n/2 && idx < m; ++j){
			ans[i].push_back(turns[idx++]);
		}
		if(i >= m){
			if(ans[i].empty()) last = i-1;
			else last = i;
			break;
		}
	}
	int left = 0;
	if(ans[K-1].empty()) left = K-1 - last;
	stack<int> moves;
	while(moves.size() < left){
		while(ans[last].size() > 1 && moves.size() < left) {
			moves.push(ans[last].back());
			ans[last].pop_back();
		}
		last--;
	}
	for(int i=last+1; i<K; ++i) {
		ans[i].push_back(moves.top());
		moves.pop();
	}
	for(int i=0; i<K; ++i){
		cout<<ans[i].size()<<" ";
		for(int j: ans[i]) cout<<j<<" ";
		cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
/* * * *   * * *   	* * * */
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, pair<ll, ll>> pll;
#define ms(a,v) memset(a,v,sizeof a)
/* * * *   * * *   	* * * */
/* *
 *
 * I love Ylva Eriksson
 *
 * */
int ts(char c) {return c == 'L' ? 0: 1;}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, k; cin>>n>>k;
	string s; cin>>s;
	bool move = 1;
	vector<vector<int>> turns;
	ll sum = 0;
	while(move){
		move = 0;
		for(int i=0; i+1<n; ){
			if(s[i] == 'R' && s[i+1] == 'L') {
				if(!move) turns.push_back({});
				turns.back().push_back(i+1);
				sum++;
				swap(s[i], s[i+1]);
				move = 1;
				i+=2;
			}else i++;
		}
	}
	int m = turns.size();
	if(m > k || sum > 1ll*k*(1ll*n/2ll) || sum < k){ cout<<-1<<endl; return 0; }
	int left = k - m;
	int idx = 0, last = 0;
	for(int i=0; i<turns.size(); ++i){
		while(turns[i].size() > 1 && k > turns.size()){
			cout<<"1 "<<turns[i].back()<<" ";
			turns.pop_back();
			k--;
			cout<<endl;
		}
		cout<<turns[i].size()<<" ";
		for(int j : turns[i]) cout<<j<<" ";
		cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
/* * * *   * * *   	* * * */
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, pair<ll, ll>> pll;
#define ms(a,v) memset(a,v,sizeof a)
/* * * *   * * *   	* * * */
/* *
 *
 * I love Ylva Eriksson
 *
 * */
int ts(char c) {return c == 'L' ? 0: 1;}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, k; cin>>n>>k;
	string s; cin>>s;
	vector<vector<int>> turns;
	ll sum = 0;
	while(1){
		turns.push_back({});
		for(int i=0; i+1<n; ++i){
			if(s[i] == 'R' && s[i+1] == 'L') {
				turns.back().push_back(i+1);
				sum++;
			}
		}
		for(int i : turns.back()) swap(s[i], s[i-1]);
		if(turns.back().empty()) {
			turns.pop_back();
			break;
		}
	}
	int m = turns.size();
	if(k < m || k > sum){ cout<<-1<<endl; return 0; }
	for(int i=0; i<turns.size(); ++i){
		while(turns[i].size() > 1 && k > turns.size()){
			cout<<"1 "<<turns[i].back()<<" ";
			turns[i].pop_back();
			k--;
			cout<<endl;
		}
		cout<<turns[i].size()<<" ";
		for(int j : turns[i]) cout<<j<<" ";
		cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
/* * * *   * * *   	* * * */
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, pair<ll, ll>> pll;
#define ms(a,v) memset(a,v,sizeof a)
/* * * *   * * *   	* * * */
/* *
 *
 * I love Ylva Eriksson
 *
 * */
int n, k;
string s;
vector<vector<int>> turns;
int ts(char c) {return c == 'L' ? 0: 1;}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin>>n>>k;
	cin>>s;
	int sum = 0;
	while(1){
		turns.push_back({});
		for(int i=0; i+1<n; ++i){
			if(s[i] == 'R' && s[i+1] == 'L') {
				turns.back().push_back(i+1);
				++sum;
			}
		}
		for(int i : turns.back()) swap(s[i-1], s[i]);
		if(turns.back().empty()) {
			turns.pop_back();
			break;
		}
	}
	if(k < turns.size() || k > sum){ cout<<-1<<endl; return 0; }
	for(int i=0; i<turns.size(); ++i){
		while(turns[i].size() > 1 && k > turns.size()){
			--k;
			cout<<"1 "<<turns[i].back()<<"\n";
			turns[i].pop_back();
		}
		cout<<turns[i].size()<<" ";
		for(int j : turns[i]) cout<<j<<" ";
		cout<<"\n";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
/* * * *   * * *   	* * * */
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, pair<ll, ll>> pll;
#define ms(a,v) memset(a,v,sizeof a)
/* * * *   * * *   	* * * */
/* *
 *
 * I love Ylva Eriksson
 *
 * */
int ts(char c) {return c == 'L' ? 0: 1;}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, k; cin>>n>>k;
	string s; cin>>s;
	bool move = 1;
	vector<vector<int>> turns;
	ll sum = 0;
	while(move){
		move = 0;
		for(int i=0; i+1<n; ){
			if(s[i] == 'R' && s[i+1] == 'L') {
				if(!move) turns.push_back({});
				turns.back().push_back(i+1);
				sum++;
				swap(s[i], s[i+1]);
				move = 1;
				i+=2;
			}else i++;
		}
	}
	int m = turns.size();
	if(m > k || sum > 1ll*k*(1ll*n/2ll) || sum < k){ cout<<-1<<endl; return 0; }
	int left = k - m;
	int idx = 0, last = 0;
	for(int i=0; i<turns.size(); ++i){
		while(turns[i].size() > 1 && k > turns.size()){
			cout<<"1 "<<turns[i].back()<<" ";
			turns[i].pop_back();
			k--;
			cout<<endl;
		}
		cout<<turns[i].size()<<" ";
		for(int j : turns[i]) cout<<j<<" ";
		cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
/* * * *   * * *   	* * * */
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, pair<ll, ll>> pll;
#define ms(a,v) memset(a,v,sizeof a)
/* * * *   * * *   	* * * */
/* *
 *
 * I love Ylva Eriksson
 *
 * */
int ts(char c) {return c == 'L' ? 0: 1;}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, k; cin>>n>>k;
	string s; cin>>s;
	bool move = 1;
	vector<vector<int>> turns;
	while(move){
		move = 0;
		for(int i=0; i+1<n; ){
			if(s[i] == 'R' && s[i+1] == 'L') {
				if(!move) turns.push_back({});
				turns.back().push_back(i+1);
				swap(s[i], s[i+1]);
				move = 1;
				i+=2;
			}else i++;
		}
	}
	int m = turns.size();
	if(m > k){ cout<<-1<<endl; return 0; }
	int last = -1, idx = 0;
	if(m < k){
		idx = turns.size() - 1;
		while(turns.size() < k) turns.push_back({});
	}
	while(last>=idx && idx >= 0){
		while(!turns[idx].empty() && last > idx){
			turns[last].push_back(turns[idx].back());
			turns[idx].pop_back();
			last--;
		}
		if(turns[idx].empty()) idx--;
	}
	if(idx < 0) { cout<<-1<<endl; return 0; }
	for(int i=0; i<k; ++i){
		cout<<turns[i].size()<<" ";
		for(int j: turns[i]) cout<<j<<" ";
		cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
/* * * *   * * *   	* * * */
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, pair<ll, ll>> pll;
#define ms(a,v) memset(a,v,sizeof a)
/* * * *   * * *   	* * * */
/* *
 *
 * I love Ylva Eriksson
 *
 * */
int ts(char c) {return c == 'L' ? 0: 1;}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, K; cin>>n>>K;
	string s; cin>>s;
	vector<pii> a;
	a.push_back({ts(s[0]), 1});
	for(int i=1; i<n; ++i){
		if(ts(s[i]) == a.back().first) {
			a.back().second++;
		}else {
			a.push_back({ts(s[i]), 1});
		}
	}
	int m = a.size(), idx, last;
	if(a[m-1].first) {
		last = m-2;
		idx = a[m-2].second;
	}else{
		last = m-1;
		idx = 0;
	}
	vector<int> turns;
	for(int i=m-2;i>=0; --i) {
		if(a[i].first){
			int sum = 0;
			for(int j = i+1; j<=last; ++j) {
				sum+=a[j].second;
			}
			for(int j=0, plus = 0;j <sum; ++j, plus++) {
				turns.push_back(n-idx-sum + plus);
			}
			for(int j=0; j<a[i].second-1; ++j){
				for(int k=0, plus = 0; k<sum; k++, plus++) {
					turns.push_back(turns[turns.size() - sum + plus] - 1);
				}
			}
			idx+=a[i].second;
			swap(a[i], a[last]);
			last--;
		}
	}
	m = turns.size();
	if(m < K || m > K*(n/2)){
		cout<<-1<<endl;
		return 0;
	}
	idx = 0;
	int tot = m/K, add = m%K;
	for(int i=0; i<K; ++i){
		cout<<min(n/2, tot + add)<<" ";
		for(int i=0; i<tot; ++i) cout<<turns[idx++]<<" ";
		for(int i = tot; i<n/2 && add > 0; ++i, add--) cout<<turns[idx++]<<" ";
		cout<<endl;
	}
	return 0;
}