//**KISS**
//**KEEP IT SHORT AND SIMPLE**

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <tuple>
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FILES freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define INF 1000000000
#define REP(i,a,b) for (int i = a; i < b; i++)
#define NL '\n'
#define F first
#define S second
#define PB push_back
#define Summation(n) (n) * ((n) + 1) / 2
#define ALL(x) x.begin(), x.end()

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef bool bl;
typedef vector < vector<long long> > vvl;
typedef vector <long long> vll;
typedef vector <string> vs;
typedef pair <long long, long long> pll;
typedef queue <long long> qll;
typedef deque <long long> dll;
typedef set <long long> sll;
typedef set <string> ss;
typedef set <char> sc;
typedef unordered_set <long long> usll;
typedef multiset <long long> msll;
typedef unordered_multiset <long long> umsll;
typedef map <long long, long long> mll;
typedef map <long long, bool> mlb;
typedef map <string, bool> msb;
typedef map <string, long long> msl;
typedef map <char, bool> mcb;
typedef map <char, long long> mcl;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//double pi = 2 * acos(0.0);

ll _sieve_size;
bitset<10000010> _bs;
vll _primes;
void sieve(ll upperbound)
{
    //O(N log log N)
    _sieve_size = upperbound;
    _bs.set();
    _bs[0] = _bs[1] = 0;
    for(ll i = 2;i <= _sieve_size;i++)
        if(_bs[i])
        {
            for(ll j = i * i;j <= _sieve_size;j+=i)
                _bs[j] = 0;
            _primes.push_back(i);
        }
}
bool isPrime(ll N)
{
    if(N <= _sieve_size)    return _bs[N];
    for(int i = 0;i < _primes.size();i++)
        if(N % _primes[i] == 0) return false;
    return true;
}
vll primeFactors(ll N)
{
    //O( sqrt(N) /ln sqrt(N))
    vll factors;
    ll PF_idx = 0, PF = _primes[PF_idx];
    //sieve should generate primes first
    while(PF * PF <= N)
    {
        while(N % PF == 0)
        {
            N /= PF;
            factors.push_back(PF);
        }
        PF = _primes[++PF_idx];
    }
    //if N itself is Prime
    if(N != 1)  factors.push_back(N);
    return factors;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
long long FastPower(long long Num, long long Pow)
{
    if(Pow == 0)
        return 1;
    if(Pow == 1)
        return Num;
    long long Result = FastPower(Num, Pow / 2);
    Result *= Result;
    if(Pow % 2 != 0)
        Result *= Num;
    return Result;
}
long long power(long long x, unsigned long long y, long long mod)
{
    long long temp;
    if( y == 0)
        return 1;
    temp = power(x, y/2,mod)%mod;
    if (y%2 == 0)
        return (temp%mod*temp%mod)%mod;
    else
        return((x%mod*temp)%mod*temp)%mod;
}
ll ncr(ll n, ll r)
{
    r = min(r, n - r);
    ll ans = 1;
    for(int i = 1;i <= r;i++)
    {
        ans *= n - i + 1;
        ans /= i;
    }
    return ans;
}
bool isPowerOfTwo(int x)
{
    // x will check if x == 0 and !(x & (x - 1)) will check if x is a power of 2 or not
    return (x && !(x & (x - 1)));
}
bool sortbysec(const pll &a, const pll &b)
{
    return (a.second < b.second);
}
double binet(unsigned int n)
{
    static const double phi = (1 + sqrt(5))*0.5;
    double fib = (pow(phi,n) - pow(1-phi,n))/sqrt(5);
    return round(fib);
}
ll b[1000005], m;
string p;
void prefixFunction()
{
    ll i = 0, j = -1;
    b[0] = -1;
    while(i < m)
    {
        while(j >= 0 && p[i] != p[j])
            j = b[j];
        i++;
        j++;
        b[i] = j;
    }
}
int main()
{
    IO
    string s;
    cin >> s;
    ll m;
    cin >> m;
    vll v, ans;
    REP(i, 0, s.size())
        if(s[i] == '1')
            v.push_back(i + 1);
    if(v.size() == 1)
    {
        m == 1 ? cout << "YES" << NL << v[0] : cout << "NO";
        return 0;
    }
    ll sum1 = v[0], sum2 = v[1], last = v[1];
    bl Flag = 1;
    ans.push_back(v[0]);
    ans.push_back(v[1]);
    m-=2;
    while(m--)
    {
        ll l = ans.size();
        REP(i, 0, v.size())
        {
            if(Flag && v[i] + sum1 > sum2 && last != v[i])
            {
                Flag = 0;
                last = v[i];
                ans.push_back(v[i]);
                sum1 += v[i];
                break;
            }
            else if(!Flag && v[i] + sum2 > sum1 && last != v[i])
            {
                Flag = 1;
                last = v[i];
                ans.push_back(v[i]);
                sum2 += v[i];
                break;
            }
        }
        if(l == ans.size())
        {
            cout << "NO";
            return 0;
        }
    }
    cout << "YES" << NL;
    REP(i, 0, ans.size())
        cout << ans[i] << ' ';
    return 0;
}


//**KEEP IT SHORT AND SIMPLE**
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FILES freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define REP(i,a,b) for (int i = a; i < b; i++)
#define NL '\n'
#define F first
#define S second
#define dot(a, b) (conj(a) * (b)).real()
#define cross(a, b) (conj(a)* (b)).imag()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef bool bl;
typedef vector < vector<long long> > vvl;
typedef vector <long long> vll;
typedef pair <long long, long long> pll;
typedef map <long long, long long> mll;
typedef map <long long, bool> mlb;
typedef priority_queue<long long, vector<long long>, greater<long long> > minPq;
typedef tuple<ll, ll, ll> line;
typedef complex<double> point;
const double pi = 2 * acos(0.0);
const int OO = 0x3f3f3f3f;
using namespace std;
int main()
{
    int n, temp;
    string s;
    cin >> s >> n;
    vector<int>v, ans;
    REP(i, 0, s.size())
        if(s[i] == '1')
            v.push_back(i + 1);
    REP(j, 0, v.size())
    {
        int sum1 = v[j], sum2 = 0, last = v[j];
        ans.push_back(v[j]);
        bl first = 0;
        REP(i, 0, n - 1)
        {
            temp = (first ? sum2 - sum1 : sum1 - sum2);
            auto it = upper_bound(v.begin(), v.end(), temp);
            if(it != v.end() && *it == last)    ++it;
            if(it == v.end())                   break;
            last = *it;
            first ? sum1 += last : sum2 += last;
            ans.push_back(last);
            first = !first;
        }
        if(ans.size() == n)
        {
            cout << "YES" << NL;
            for(auto it : ans)    cout << it << ' ';
            return 0;
        }
        ans.clear();
    }
    cout << "NO";
    return 0;
}


//**KISS**
//**KEEP IT SHORT AND SIMPLE**

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <tuple>
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FILES freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define INF 1000000000
#define REP(i,a,b) for (int i = a; i < b; i++)
#define NL '\n'
#define F first
#define S second
#define PB push_back
#define Summation(n) (n) * ((n) + 1) / 2
#define ALL(x) x.begin(), x.end()

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef bool bl;
typedef vector < vector<long long> > vvl;
typedef vector <long long> vll;
typedef vector <string> vs;
typedef pair <long long, long long> pll;
typedef queue <long long> qll;
typedef deque <long long> dll;
typedef set <long long> sll;
typedef set <string> ss;
typedef set <char> sc;
typedef unordered_set <long long> usll;
typedef multiset <long long> msll;
typedef unordered_multiset <long long> umsll;
typedef map <long long, long long> mll;
typedef map <long long, bool> mlb;
typedef map <string, bool> msb;
typedef map <string, long long> msl;
typedef map <char, bool> mcb;
typedef map <char, long long> mcl;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//double pi = 2 * acos(0.0);

ll _sieve_size;
bitset<10000010> _bs;
vll _primes;
void sieve(ll upperbound)
{
    //O(N log log N)
    _sieve_size = upperbound;
    _bs.set();
    _bs[0] = _bs[1] = 0;
    for(ll i = 2;i <= _sieve_size;i++)
        if(_bs[i])
        {
            for(ll j = i * i;j <= _sieve_size;j+=i)
                _bs[j] = 0;
            _primes.push_back(i);
        }
}
bool isPrime(ll N)
{
    if(N <= _sieve_size)    return _bs[N];
    for(int i = 0;i < _primes.size();i++)
        if(N % _primes[i] == 0) return false;
    return true;
}
vll primeFactors(ll N)
{
    //O( sqrt(N) /ln sqrt(N))
    vll factors;
    ll PF_idx = 0, PF = _primes[PF_idx];
    //sieve should generate primes first
    while(PF * PF <= N)
    {
        while(N % PF == 0)
        {
            N /= PF;
            factors.push_back(PF);
        }
        PF = _primes[++PF_idx];
    }
    //if N itself is Prime
    if(N != 1)  factors.push_back(N);
    return factors;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
long long FastPower(long long Num, long long Pow)
{
    if(Pow == 0)
        return 1;
    if(Pow == 1)
        return Num;
    long long Result = FastPower(Num, Pow / 2);
    Result *= Result;
    if(Pow % 2 != 0)
        Result *= Num;
    return Result;
}
long long power(long long x, unsigned long long y, long long mod)
{
    long long temp;
    if( y == 0)
        return 1;
    temp = power(x, y/2,mod)%mod;
    if (y%2 == 0)
        return (temp%mod*temp%mod)%mod;
    else
        return((x%mod*temp)%mod*temp)%mod;
}
ll ncr(ll n, ll r)
{
    r = min(r, n - r);
    ll ans = 1;
    for(int i = 1;i <= r;i++)
    {
        ans *= n - i + 1;
        ans /= i;
    }
    return ans;
}
bool isPowerOfTwo(int x)
{
    // x will check if x == 0 and !(x & (x - 1)) will check if x is a power of 2 or not
    return (x && !(x & (x - 1)));
}
bool sortbysec(const pll &a, const pll &b)
{
    return (a.second < b.second);
}
double binet(unsigned int n)
{
    static const double phi = (1 + sqrt(5))*0.5;
    double fib = (pow(phi,n) - pow(1-phi,n))/sqrt(5);
    return round(fib);
}
ll b[1000005], m;
string p;
void prefixFunction()
{
    ll i = 0, j = -1;
    b[0] = -1;
    while(i < m)
    {
        while(j >= 0 && p[i] != p[j])
            j = b[j];
        i++;
        j++;
        b[i] = j;
    }
}
int main()
{
    IO
    string s;
    cin >> s;
    ll m;
    cin >> m;
    vll v;
    REP(i, 0, s.size())
        if(s[i] == '1')
            v.push_back(i + 1);
    ll L = (m + 1) / 2, R = m / 2;
    ll x = L * v[v.size() - 1], y = R * v[0];
    if(x != y)
    {
        bl Flag = 1;
        cout << "YES" << NL;
        while(m--)
        {
            if(Flag)
            {
                cout << v[0];
                Flag = 0;
            }
            else
            {
                cout << v[v.size() - 1];
                Flag = 1;
            }
            cout << ' ';
        }
    }
    else
        cout << "NO";
    return 0;
}


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

string s;
int m;
int dp[1005][15];
vector<int> have;

int main()
{
    ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);

    cin >> s >> m;
    for(int i = 0 ; i < s.size() ; i++)
        if(s[i] == '1')
            have.push_back(i+1) , dp[0][i+1] = i+1;

    for(int i = 1 ; i < m ; i++)
        for(int j = 0 ; j < 15 ; j++)
            if(dp[i-1][j])
                for(auto k : have)
                    if(k > j && k != dp[i-1][j])
                        dp[i][k-j] = k;

    int curr = -1;
     for(int j = 0 ; j < 15 ; j++)
        if(dp[m-1][j])
            curr = j;

    if(curr == -1)
        return cout <<  "NO" , 0;

    cout << "YES" << endl;
    for(int i = m-1 ; i >= 0 ; i--)
    {
        if(i != m-1)
        {
            for(int j = 0 ; j < 15 ; j++)
            {
                if(dp[i+1][curr] > j && curr == dp[i+1][curr] - j && dp[i][j])
                {
                    curr = j;
                    break;
                }
            }
        }

        cout << dp[i][curr] << " ";
    }

    return 0;
}


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

string s;
int m;
int dp[1005][15];
vector<int> have;

int main()
{
    ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);

    cin >> s >> m;
    for(int i = 0 ; i < s.size() ; i++)
        if(s[i] == '1')
            have.push_back(i+1) , dp[0][i+1] = i+1;

    for(int i = 1 ; i < m ; i++)
        for(int j = 0 ; j < 15 ; j++)
            if(dp[i-1][j])
                for(auto k : have)
                    if(k > j && k != dp[i-1][j])
                        dp[i][k-j] = k;

    int curr = -1;
     for(int j = 0 ; j < 15 ; j++)
        if(dp[m-1][j])
            curr = j;

    if(curr == -1)
        return cout <<  "NO" , 0;

    for(int i = m-1 ; i >= 0 ; i--)
    {
        if(i != m-1)
        {
            for(int j = 0 ; j < 15 ; j++)
            {
                if(dp[i+1][curr] > j && curr == dp[i+1][curr] - j && dp[i][j])
                {
                    curr = j;
                    break;
                }
            }
        }

        cout << dp[i][curr] << " ";
    }

    return 0;
}


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

int main()
{
    ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);

    string s;
    pair<int , int> w = {0 , 0};
    cin >> s;
    int m;
    cin >> m;
    vector<int> have;
    for(int i = 0 ; i < s.size() ; i++)
    {
        if(s[i] == '1')
        {
            have.push_back(i+1);
        }
    }

    if(have.size() > 0 && m == 1)
        return cout << "YES" << endl << have[0] , 0;

    if(have.size() > 1 && m == 2)
        return cout << "YES" << endl << min(have[0],have[1]) << " " << max(have[1],have[0]) , 0;

    int dif = 0;
    for(int i = 0 ; i + 1 < have.size() ; i++)
    {
        if(have[i+1] < have[i] * 2)
            dif = have[i] , w.second = have[i] , w.first = have[i+1];
    }

    if(dif == 0)
        return cout << "NO" , 0;

    cout << "YES" << endl;
    int counter = 1;
    while(m--)
    {
        if(counter % 2)
            cout << min(w.first , w.second) << " ";
        else cout << max(w.first , w.second) << " ";
        counter++;
    }
    return 0;

    cout << "NO";

    return 0;
}


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

int main()
{
    ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);

    string s;
    pair<int , int> w = {0 , 0};
    cin >> s;
    int m;
    cin >> m;
    vector<int> have;
    for(int i = 0 ; i < s.size() ; i++)
    {
        if(s[i] == '1')
        {
            have.push_back(i+1);
        }
    }

    if(have.size() > 0 && m == 1)
        return cout << "YES" << endl << have[0] , 0;

    if(have.size() > 1 && m == 2)
        return cout << "YES" << endl << min(have[0],have[1]) << " " << max(have[1],have[0]) , 0;

    int dif = 0 , mn;
    for(int i = 0 ; i + 1 < have.size() ; i++)
    {
        if(have[i+1] < have[i] * 2)
            dif = have[i] , mn = w.second , w.first = have[i] , w.second = have[i+1];
    }

    if(dif == 0)
        return cout << "NO" , 0;

    vector<int> ans;
    int l = 0 , r = 0;
    for(int i = 0 ; i < m ; i++)
    {
        if(i % 2)
        {
            if(l + w.first > r + w.second)
            {
                r+= w.second;
                ans.push_back(w.second);
            }
            else if(l + w.first > r + mn)
            {
                r += mn;
                ans.push_back(mn);
            }
            else break;
        }
        else
        {
            if(r + w.second < l + w.first) return cout << "NO" , 0;
            ans.push_back(w.first);
            l += w.first;
        }
    }

    if(ans.size() != m)
        return cout << "NO" , 0;

    cout << "YES" << endl;
    for(auto i : ans)
        cout << i << " ";

    return 0;
}


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

int main()
{
    ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);

    string s;
    pair<int , int> w = {0 , 0};
    cin >> s;
    int m;
    cin >> m;
    for(int i = 0 ; i < s.size() ; i++)
    {
        if(s[i] == '1')
        {
            if(w.first == 0)
                w.first = i+1;
            else
            {
                w.second = i+1;
                break;
            }
        }
    }

    if(w.first < w.second)
        swap(w.first , w.second);

    if(w.first != 0)
    {
        cout << "YES" << endl;
        while(m--)
            (m % 2) ? cout << w.first << " " : cout << w.second << " " ;
        return 0;
    }

    cout << "NO";

    return 0;
}


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

int main()
{
    ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);

    string s;
    pair<int , int> w = {0 , 0};
    cin >> s;
    int m;
    cin >> m;
    vector<int> have;
    for(int i = 0 ; i < s.size() ; i++)
    {
        if(s[i] == '1')
        {
            have.push_back(i+1);
        }
    }

    if(have.size() > 0 && m == 1)
        return cout << "YES" << endl << have[0] , 0;

    if(have.size() > 1 && m == 2)
        return cout << "YES" << endl << have[0] << " " << have[1] , 0;

    int dif = 0;
    for(int i = 0 ; i + 1 < have.size() ; i++)
    {
        if(have[i+1] < have[i] * 2)
            dif = have[i] , w.second = have[i] , w.first = have[i+1];
    }

    if(dif == 0)
        return cout << "NO" , 0;

    cout << "YES" << endl;
    int counter = 1;
    while(m--)
    {
        if(counter % 2)
            cout << min(w.first , w.second) << " ";
        else cout << max(w.first , w.second) << " ";
        counter++;
    }
    return 0;

    cout << "NO";

    return 0;
}


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

int main()
{
    ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);

    string s;
    pair<int , int> w = {0 , 0};
    cin >> s;
    int m;
    cin >> m;
    for(int i = 0 ; i < s.size() ; i++)
    {
        if(s[i] == '1')
        {
            if(w.first == 0)
                w.first = i+1;
            else
            {
                w.second = i+1;
                break;
            }
        }
    }

    if(w.first < w.second)
        swap(w.first , w.second);

    if(w.second != 0)
    {
        cout << "YES" << endl;
        while(m--)
            (m % 2) ? cout << w.first << " " : cout << w.second << " " ;
        return 0;
    }

    cout << "NO";

    return 0;
}


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

int main()
{
    ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);

    string s;
    pair<int , int> w = {0 , 0};
    cin >> s;
    int m;
    cin >> m;
    vector<int> have;
    for(int i = 0 ; i < s.size() ; i++)
    {
        if(s[i] == '1')
        {
            have.push_back(i+1);
        }
    }

    if(have.size() > 0 && m == 1)
        return cout << "YES" << endl << have[0] , 0;

    if(have.size() > 1 && m == 2)
        return cout << "YES" << endl << min(have[0],have[1]) << " " << max(have[1],have[0]) , 0;

    int dif = 0 , mn;
    for(int i = 0 ; i + 1 < have.size() ; i++)
    {
        if(have[i+1] < have[i] * 2)
            dif = have[i] , mn = w.first , w.first = have[i] , w.second = have[i+1];
    }

    if(dif == 0)
        return cout << "NO" , 0;

    vector<int> ans;
    int l = 0 , r = 0;
    for(int i = 0 ; i < m ; i++)
    {
        if(i % 2)
        {
            if(l + w.first > r + w.second)
            {
                r+= w.second;
                ans.push_back(w.second);
            }
            else if(l + w.first > r + mn && mn != 0)
            {
                r += mn;
                ans.push_back(mn);
            }
            else break;
        }
        else
        {
            if(r + w.second < l + w.first) return cout << "NO" , 0;
            ans.push_back(w.first);
            l += w.first;
        }
    }

    if(ans.size() != m)
        return cout << "NO" , 0;

    cout << "YES" << endl;
    for(auto i : ans)
        cout << i << " ";

    return 0;
}


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

int main()
{
    ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);

    string s;
    pair<int , int> w = {0 , 0};
    cin >> s;
    int m;
    cin >> m;
    vector<int> have;
    for(int i = 0 ; i < s.size() ; i++)
    {
        if(s[i] == '1')
        {
            have.push_back(i+1);
        }
    }

    if(have.size() > 0 && m == 1)
        return cout << "YES" << endl << have[0] , 0;

    if(have.size() > 1 && m == 2)
        return cout << "YES" << endl << min(have[0],have[1]) << " " << max(have[1],have[0]) , 0;

    int dif = 0 , mn;
    for(int i = 0 ; i + 1 < have.size() ; i++)
    {
        if(have[i+1] < have[i] * 2)
            dif = have[i] , mn = w.first , w.first = have[i] , w.second = have[i+1];
    }

    if(dif == 0)
        return cout << "NO" , 0;

    vector<int> ans;
    int l = 0 , r = 0;
    for(int i = 0 ; i < m ; i++)
    {
        if(i % 2)
        {
            if(l + w.first > r + w.second)
            {
                r+= w.second;
                ans.push_back(w.second);
            }
            else if(l + w.first > r + mn)
            {
                r += mn;
                ans.push_back(mn);
            }
            else break;
        }
        else
        {
            if(r + w.second < l + w.first) return cout << "NO" , 0;
            ans.push_back(w.first);
            l += w.first;
        }
    }

    if(ans.size() != m)
        return cout << "NO" , 0;

    cout << "YES" << endl;
    for(auto i : ans)
        cout << i << " ";

    return 0;
}


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

string s;
int m;
int dp[1005][15];
vector<int> have;

int main()
{
    ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);

    cin >> s >> m;
    for(int i = 0 ; i < s.size() ; i++)
        if(s[i] == '1')
            have.push_back(i+1) , dp[0][i+1] = i+1;

    for(int i = 1 ; i < m ; i++)
        for(int j = 0 ; j < 15 ; j++)
            if(dp[i-1][j])
                for(auto k : have)
                    if(k > j && k != dp[i-1][j])
                        dp[i][k-j] = k;

    int curr = -1;
    for(int j = 0 ; j < 15 ; j++)
        if(dp[m-1][j])
            curr = j;

    if(curr == -1)
        return cout <<  "NO" , 0;

    vector<int> ans;
    for(int i = m-1 ; i >= 0 ; i--)
    {
        if(i != m-1)
        {
            for(int j = 0 ; j < 15 ; j++)
            {
                if(dp[i+1][curr] > j && curr == dp[i+1][curr] - j && dp[i][j])
                {
                    curr = j;
                    break;
                }
            }
        }

        ans.push_back(dp[i][curr]);
    }

    reverse(ans.begin() ,ans.end());

    cout << "YES" << endl;
    for(auto i : ans)
        cout << i << " ";

    return 0;
}


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

int main()
{
    ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);

    string s;
    pair<int , int> w = {0 , 0};
    cin >> s;
    int m;
    cin >> m;
    vector<int> have;
    for(int i = 0 ; i < s.size() ; i++)
    {
        if(s[i] == '1')
        {
            have.push_back(i+1);
        }
    }

    if(have.size() > 0 && m == 1)
        return cout << "YES" << endl << have[0] , 0;

    if(have.size() > 1 && m == 2)
        return cout << "YES" << endl << min(have[0],have[1]) << " " << max(have[1],have[0]) , 0;

    int dif = 0;
    for(int i = 0 ; i + 1 < have.size() ; i++)
    {
        if(have[i+1] < have[i] * 2)
            dif = have[i] , w.first = have[i] , w.second = have[i+1];
    }

    int mn = have[0];
    if(dif == 0)
        return cout << "NO" , 0;

    vector<int> ans;
    int l = 0 , r = 0;
    for(int i = 0 ; i < m ; i++)
    {
        if(i % 2)
        {
            if(l + w.first > r + w.second)
            {
                r+= w.second;
                ans.push_back(w.second);
            }
            else if(l + w.first > r + mn)
            {
                r += mn;
                ans.push_back(mn);
            }
            else break;
        }
        else
        {
            ans.push_back(w.first);
            l += w.first;
        }
    }

    if(ans.size() != m)
        return cout << "NO" , 0;

    cout << "YES" << endl;
    for(auto i : ans)
        cout << i << " ";

    return 0;
}


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

string s;
int m;
bool dp[1005][15][15];
vector<int> have;

int main()
{
    ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);

    cin >> s >> m;
    for(int i = 0 ; i < s.size() ; i++)
        if(s[i] == '1')
            have.push_back(i+1) , dp[0][i+1][i+1] = 1;

    for(int i = 1 ; i < m ; i++)
        for(int j = 0 ; j < 15 ; j++)
            for(auto l : have)
                if(dp[i-1][j][l])
                    for(auto k : have)
                        if(k > j && k != l)
                            dp[i][k-j][k] = 1;

    int curr = -1 , curr2 = -1;
    for(int j = 0 ; j < 15 ; j++)
        for(auto i : have)
            if(dp[m-1][j][i])
                curr = j , curr2 = i;

    if(curr == -1)
        return cout <<  "NO" , 0;

    vector<int> ans;
    for(int i = m-1 ; i >= 0 ; i--)
    {
        if(i != m-1)
        {
            for(int j = 0 ; j < 15 ; j++)
            {
                bool c = 0;
                for(auto k : have)
                {
                    if(curr == curr2 - j && curr2 != k && dp[i][j][k])
                    {
                        c = 1;
                        curr = j , curr2 = k;
                        break;
                    }
                }
                if(c)
                    break;
            }
        }

        ans.push_back(curr2);
    }

    reverse(ans.begin() ,ans.end());

    cout << "YES" << endl;
    for(auto i : ans)
        cout << i << " ";

    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
    int m,a ;
    vector<int> v;
    int min;
    string str;
    cin >> str;
    cin >> m ;
    for(int i=0;i<10;i++)
    {
        if(str.at(i)=='1')
            v.push_back(i+1);
    }
    if(v.size()==1&&m==1)
    {
        cout << "YES" ;
        cout << "\n" << v[0];
        return 0;
    }
    if(v.size()==0||v.size()==1)
    {
        cout << "NO";
        return 0;
    }
    int l = v.size();
    int dp[m+1] ;
    dp[0]=0;
    /*if(l%2==0)
    {
        dp[1]=v[l/2-1];
    }
    else
    {
        dp[1]=v[l/2];
    }*/
    //dp[1]=v[v.size()-2];
    int diff = 20,d;
    for(int i=0;i<v.size()-1;i++)
    {
        d = v[i+1]-v[i];
        if(d<=diff)
        {
            dp[1]=v[i];
            diff =d ;
        }
    }
    vector<int>::iterator it;
    int r;
    r=dp[0];
    l = dp[1];
    int last;
    //cout << dp[1] << " ";
    for(int i=2;i<=m;i++)
    {
        it = upper_bound(v.begin(),v.end(),abs(l-r));
        //cout << *it;
        if(it==v.end())
        {
            cout << "NO" ;
            return 0;
        }
        if(*it==last)
            it = upper_bound(v.begin(),v.end(),last);
        if(it==v.end())
        {
            cout << "NO";
            return 0 ;
        }
        dp[i]=*it;
        if(i%2==0)
            r+=dp[i];
        else
            l+=dp[i];
        last = *it;
        //cout << dp[i] << " ";
    }
    cout << "YES" << "\n";
    for(int i=1;i<=m;i++)
        cout << dp[i] << " " ;
    return 0;
}
/*INPUT
1111111111
10
*/


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int m,a ;
    vector<int> v;
    int min;
    string str;
    cin >> str;
    cin >> m ;
    for(int i=0;i<10;i++)
    {
        if(str.at(i)=='1')
            v.push_back(i+1);
    }
    if(v.size()==1&&m==1)
    {
        cout << "YES" ;
        cout << "\n" << v[0];
        return 0;
    }
    if(v.size()==0||v.size()==1)
    {
        cout << "NO";
        return 0;
    }
    int l = v.size();
    int dp[m+1] ;
    dp[0]=0;
    if(l%2==0)
    {
        dp[1]=v[l/2-1];
    }
    else
    {
        dp[1]=v[l/2];
    }
    vector<int>::iterator it;
    for(int i=2;i<=m;i++)
    {
        it = upper_bound(v.begin(),v.end(),dp[i-1]-dp[i-2]+1);
        //cout << *it;
        if(it==v.end())
        {
            cout << "NO" ;
            return 0;
        }
        dp[i]=*it;
    }
    cout << "YES" << "\n";
    for(int i=1;i<=m;i++)
        cout << dp[i] << " " ;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int m,a ;
    vector<int> v;
    int min;
    string str;
    cin >> str;
    cin >> m ;
    for(int i=0;i<10;i++)
    {
        if(str.at(i)=='1')
            v.push_back(i+1);
    }
    if(v.size()==0||v.size()==1)
    {
        cout << "NO";
        return 0;
    }
    int l = v.size();
    int dp[m+1] ;
    dp[0]=0;
    if(l%2==0)
    {
        dp[1]=v[l/2-1];
    }
    else
    {
        dp[1]=v[l/2];
    }
    vector<int>::iterator it;
    for(int i=2;i<=m;i++)
    {
        it = upper_bound(v.begin(),v.end(),dp[i-1]-dp[i-2]+1);
        //cout << *it;
        if(it==v.end())
        {
            cout << "NO" ;
            return 0;
        }
        dp[i]=*it;
    }
    for(int i=1;i<=m;i++)
        cout << dp[i] << " " ;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int m,a,l,r,last;
int dp[1005];
vector<int> v;
vector<int>::iterator it;

int tryagain()
{
    r=dp[0];
    l=dp[1];
    for(int i=2;i<=m;i++)
    {
        it = upper_bound(v.begin(),v.end(),abs(l-r));
        //cout << *it;
        if(it==v.end())
        {
            cout << "NO" ;
            return 0;
        }
        if(*it==last)
            it = upper_bound(v.begin(),v.end(),last+1);
        if(it==v.end())
        {
            return -1;
        }
        dp[i]=*it;
        if(i%2==0)
            r+=dp[i];
        else
            l+=dp[i];
        last = *it;
        //cout << dp[i] << " ";
    }
    return 1;
}

int main()
{
    string str;
    cin >> str;
    cin >> m ;
    for(int i=0;i<10;i++)
    {
        if(str.at(i)=='1')
            v.push_back(i+1);
    }
    if(v.size()==1&&m==1)
    {
        cout << "YES" ;
        cout << "\n" << v[0];
        return 0;
    }
    if(v.size()==0||v.size()==1)
    {
        cout << "NO";
        return 0;
    }
    l = v.size();
    dp[0]=0;
    /*if(l%2==0)
    {
        dp[1]=v[l/2-1];
    }
    else
    {
        dp[1]=v[l/2];
    }*/
    //dp[1]=v[v.size()-2];
    int diff = 20,d;
    for(int i=0;i<v.size()-1;i++)
    {
        d = v[i+1]-v[i];
        if(d<=diff)
        {
            dp[1]=v[i];
            diff =d ;
        }
    }
    r=dp[0];
    l = dp[1];
    //cout << dp[1] << " ";
    for(int i=2;i<=m;i++)
    {
        it = upper_bound(v.begin(),v.end(),abs(l-r));
        //cout << *it;
        if(it==v.end())
        {
            cout << "NO" ;
            return 0;
        }
        if(*it==last)
            it = upper_bound(v.begin(),v.end(),last);
        if(it==v.end())
        {
            if(tryagain()==1)
                break;
            else
            {
                cout << "NO";
                return 0;
            }
        }
        dp[i]=*it;
        if(i%2==0)
            r+=dp[i];
        else
            l+=dp[i];
        last = *it;
        //cout << dp[i] << " ";
    }
    cout << "YES" << "\n";
    for(int i=1;i<=m;i++)
        cout << dp[i] << " " ;
    return 0;
}
/*INPUT
1111111111
10
*/


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
    int m,a ;
    vector<int> v;
    int min;
    string str;
    cin >> str;
    cin >> m ;
    for(int i=0;i<10;i++)
    {
        if(str.at(i)=='1')
            v.push_back(i+1);
    }
    if(v.size()==1&&m==1)
    {
        cout << "YES" ;
        cout << "\n" << v[0];
        return 0;
    }
    if(v.size()==0||v.size()==1)
    {
        cout << "NO";
        return 0;
    }
    int l = v.size();
    int dp[m+1] ;
    dp[0]=0;
    if(l%2==0)
    {
        dp[1]=v[l/2-1];
    }
    else
    {
        dp[1]=v[l/2];
    }
    vector<int>::iterator it;
    int r;
    r=dp[0];
    l = dp[1];
    int last;
    for(int i=2;i<=m;i++)
    {
        it = upper_bound(v.begin(),v.end(),abs(l-r));
        //cout << *it;
        if(*it==last)
            it = upper_bound(v.begin(),v.end(),last);
        if(it==v.end())
        {
            cout << "NO" ;
            return 0;
        }
        dp[i]=*it;
        if(i%2==0)
            r+=dp[i];
        else
            l+=dp[i];
        last = *it;
    }
    cout << "YES" << "\n";
    for(int i=1;i<=m;i++)
        cout << dp[i] << " " ;
    return 0;
}
/*INPUT
1111111111
10
*/


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
    int m,a ;
    vector<int> v;
    int min;
    string str;
    cin >> str;
    cin >> m ;
    for(int i=0;i<10;i++)
    {
        if(str.at(i)=='1')
            v.push_back(i+1);
    }
    if(v.size()==1&&m==1)
    {
        cout << "YES" ;
        cout << "\n" << v[0];
        return 0;
    }
    if(v.size()==0||v.size()==1)
    {
        cout << "NO";
        return 0;
    }
    int l = v.size();
    int dp[m+1] ;
    dp[0]=0;
    /*if(l%2==0)
    {
        dp[1]=v[l/2-1];
    }
    else
    {
        dp[1]=v[l/2];
    }*/
    //dp[1]=v[v.size()-2];
    int diff = 20,d;
    for(int i=0;i<v.size()-1;i++)
    {
        d = v[i+1]-v[i];
        if(d<=diff)
        {
            dp[1]=v[i];
            diff =d ;
        }
    }
    vector<int>::iterator it;
    int r;
    r=dp[0];
    l = dp[1];
    int last;
    //cout << dp[1] << " ";
    for(int i=2;i<=m;i++)
    {
        it = upper_bound(v.begin(),v.end(),abs(l-r));
        //cout << *it;
        if(it==v.end())
        {
            cout << "NO" ;
            return 0;
        }
        if(*it==last)
            it = upper_bound(v.begin(),v.end(),last+1);
        if(it==v.end())
            it = upper_bound(v.begin(),v.end(),last);
        if(it==v.end())
        {
            cout << "NO";
            return 0 ;
        }
        dp[i]=*it;
        if(i%2==0)
            r+=dp[i];
        else
            l+=dp[i];
        last = *it;
        //cout << dp[i] << " ";
    }
    cout << "YES" << "\n";
    for(int i=1;i<=m;i++)
        cout << dp[i] << " " ;
    return 0;
}
/*INPUT
1111111111
10
*/


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int m,a ;
    vector<int> v;
    int min;
    string str;
    cin >> str;
    cin >> m ;
    for(int i=0;i<10;i++)
    {
        if(str.at(i)=='1')
            v.push_back(i+1);
    }
    if(v.size()==0||v.size()==1)
    {
        cout << "NO";
        return 0;
    }
    int l = v.size();
    int dp[m+1] ;
    dp[0]=0;
    if(l%2==0)
    {
        dp[1]=v[l/2-1];
    }
    else
    {
        dp[1]=v[l/2];
    }
    vector<int>::iterator it;
    for(int i=2;i<=m;i++)
    {
        it = upper_bound(v.begin(),v.end(),dp[i-1]-dp[i-2]+1);
        //cout << *it;
        if(it==v.end())
        {
            cout << "NO" ;
            return 0;
        }
        dp[i]=*it;
    }
    cout << "YES" << "\n";
    for(int i=1;i<=m;i++)
        cout << dp[i] << " " ;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
    int m,a ;
    vector<int> v;
    int min;
    string str;
    cin >> str;
    cin >> m ;
    for(int i=0;i<10;i++)
    {
        if(str.at(i)=='1')
            v.push_back(i+1);
    }
    if(v.size()==1&&m==1)
    {
        cout << "YES" ;
        cout << "\n" << v[0];
        return 0;
    }
    if(v.size()==0||v.size()==1)
    {
        cout << "NO";
        return 0;
    }
    int l = v.size();
    int dp[m+1] ;
    dp[0]=0;
    /*if(l%2==0)
    {
        dp[1]=v[l/2-1];
    }
    else
    {
        dp[1]=v[l/2];
    }*/
    //dp[1]=v[v.size()-2];
    int diff = 20,d;
    for(int i=0;i<v.size()-1;i++)
    {
        d = v[i+1]-v[i];
        if(d<=diff)
        {
            dp[1]=v[i];
            diff =d ;
        }
    }
    vector<int>::iterator it;
    int r;
    r=dp[0];
    l = dp[1];
    int last;
    //cout << dp[1] << " ";
    for(int i=2;i<=m;i++)
    {
        it = upper_bound(v.begin(),v.end(),abs(l-r));
        //cout << *it;
        if(it==v.end())
        {
            cout << "NO" ;
            return 0;
        }
        if(*it==last)
            it = upper_bound(v.begin(),v.end(),last+1);
        if(it==v.end())
        {
            cout << "NO";
            return 0 ;
        }
        dp[i]=*it;
        if(i%2==0)
            r+=dp[i];
        else
            l+=dp[i];
        last = *it;
        //cout << dp[i] << " ";
    }
    cout << "YES" << "\n";
    for(int i=1;i<=m;i++)
        cout << dp[i] << " " ;
    return 0;
}
/*INPUT
1111111111
10
*/


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
int n;
int dp[1001][11][11];
int mark[1001][11][11];
int rec(int step, int dif, int last){
    if(dp[step][dif][last] != -1)
        return dp[step][dif][last];

    if(step <= 0)
        return 0;

    int ok = 0;
    for(int x=0;x<10;x++){
        if(s[x] == '1' && x+1 != last){
            if(dif - last == 0) continue;
            int cur = rec(step-1, abs(dif-last), x+1);
            if(cur){
                ok = cur;
                mark[step][dif][last] = x+1;
                break;
            }
        }
    }
    return dp[step][dif][last] = ok;
}
int main(){
    memset(dp, -1, sizeof dp);
    cin>>s>>n;

    if(n == 1){
        cout<<"YES\n";
        for(int x=0;x<10;x++){
            if(s[x] == '1'){
                cout<<x+1;
                return 0;
            }
        }
    }
    for(int x=0;x<10;x++){
        if(s[x] == '1'){
            dp[1][x+1][x+1] = 1;
        }
    }

    int isPossible = false;
    int ansDif, ansDig;
    for(int x=0;x<10;x++){
        if(s[x] == '1'){
            for(int y=1;y<x+1;y++){
                int cur = rec(n, abs(y-x-1), x+1);
                if(cur){
                    isPossible = 1;
                    ansDif =abs( y-x-1);
                    ansDig = x+1;
                    break;
                }
            }

        }
    }
    if(!isPossible){
        cout<<"NO\n";
        return 0;
    }
    //cout<<mark[2][2][10]<<endl;
    vector<int> res;
    res.push_back(ansDig);
    int curDif = ansDif;
    int step = n;
    int last = ansDig;

    while(step > 1){
        int temp = mark[step][curDif][last];
        res.push_back(temp);
        step--;
        curDif = abs(last - curDif);
        last = temp;
    }
    reverse(res.begin(), res.end());

    cout<<"YES\n";

    for(auto i : res)
        cout<<i<<" ";
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
int n;
int dp[1001][11][11];
pair<int, int> mark[1001][11][11];
int main(){
    cin>>s>>n;
    if(n == 1){
        cout<<"YES\n";
        for(int x=0;x<10;x++){
            if(s[x] == '1'){
                cout<<x+1;
                return 0;
            }
        }
    }
    for(int x=0;x<10;x++){
        if(s[x] == '1'){
            dp[1][x+1][x+1] = 1;
        }
    }

    for(int x=2;x<=n;x++){
        for(int y = 1;y<=9;y++){
            for(int z= 1; z<=10; z++){
                if(s[z-1] == '0' || y >= z) continue;
                for(int a = 1; a<=10; a++){
                    if(a == z ) continue;

                    if(dp[x-1][z-y][a]){
                        dp[x][y][z] = 1;
                        mark[x][y][z].first = z-y;
                        mark[x][y][z].second = a;
                        break;
                    }
                }
            }
        }
    }
    bool found = false;
    int curDif, curDig;
    for(int x=1;x<=9;x++){
        for(int z=1;z<=10;z++){
            if(dp[n][x][z]){
                found = true;
                curDif = x;
                curDig = z;
                break;
            }
        }
    }
    if(!found) return cout<<"NO\n",0;

    vector<int> ans;
    ans.push_back(curDig);
    int step = n;
    while(step > 1){
        ans.push_back(mark[step][curDif][curDig].second);
        int temp = curDif;
        curDif = mark[step][curDif][curDig].first;
        curDig = mark[step][temp][curDig].second;
        step--;
    }
    cout<<"YES\n";
    reverse(ans.begin(), ans.end());
    for(auto i : ans)
        cout<<i<<" ";
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
int n;
int dp[1001][11][11];
int mark[1001][11][11];
int rec(int step, int dif, int last){
    if(dp[step][dif][last] != -1)
        return dp[step][dif][last];

    if(step <= 0)
        return 0;

    int ok = 0;
    for(int x=0;x<10;x++){
        if(s[x] == '1' && x+1 != last){
            int cur = rec(step-1, abs(dif-last), x+1);
            if(cur){
                ok = cur;
                mark[step][dif][last] = x+1;
                break;
            }
        }
    }
    return dp[step][dif][last] = ok;
}
int main(){
    memset(dp, -1, sizeof dp);
    cin>>s>>n;
    for(int x=0;x<10;x++){
        if(s[x] == '1'){
            dp[1][x+1][x+1] = 1;
        }
    }

    int isPossible = false;
    int ansDif, ansDig;
    for(int x=0;x<10;x++){
        if(s[x] == '1'){
            for(int y=1;y<x+1;y++){
                int cur = rec(n, abs(y-x-1), x+1);
                if(cur){
                    isPossible = 1;
                    ansDif =abs( y-x-1);
                    ansDig = x+1;
                    break;
                }
            }

        }
    }
    if(!isPossible){
        cout<<"NO\n";
        return 0;
    }
    //cout<<mark[2][2][10]<<endl;
    vector<int> res;
    res.push_back(ansDig);
    int curDif = ansDif;
    int step = n;
    int last = ansDig;

    while(step > 1){
        int temp = mark[step][curDif][last];
        res.push_back(temp);
        step--;
        curDif = abs(last - curDif);
        last = temp;
    }
    reverse(res.begin(), res.end());

    cout<<"YES\n";

    for(auto i : res)
        cout<<i<<" ";
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
int n;
int dp[1001][11][11];
int mark[1001][11][11];
int rec(int step, int dif, int last){
    if(dp[step][dif][last] != -1)
        return dp[step][dif][last];

    if(step <= 0)
        return 0;

    int ok = 0;
    for(int x=0;x<10;x++){
        if(s[x] == '1' && x+1 != last){
            if(dif - last == 0) continue;
            int cur = rec(step-1, abs(dif-last), x+1);
            if(cur){
                ok = cur;
                mark[step][dif][last] = x+1;
                break;
            }
        }
    }
    return dp[step][dif][last] = ok;
}
int main(){
    memset(dp, -1, sizeof dp);
    cin>>s>>n;

    if(n == 1){
        cout<<"YES\n";
        for(int x=0;x<10;x++){
            if(s[x] == '1'){
                cout<<x+1;
                return 0;
            }
        }
    }
    for(int x=0;x<10;x++){
        if(s[x] == '1'){
            dp[1][x+1][x+1] = 1;
        }
    }

    int isPossible = false;
    int ansDif, ansDig;
    for(int x=0;x<10;x++){
        if(s[x] == '1'){
            for(int y=1;y<x+1;y++){
                int cur = rec(n, y, x+1);
                if(cur){
                    isPossible = 1;
                    ansDif =y;
                    ansDig = x+1;
                    break;
                }
            }

        }
    }
    if(!isPossible){
        cout<<"NO\n";
        return 0;
    }
    //cout<<mark[2][2][10]<<endl;
    vector<int> res;
    res.push_back(ansDig);
    int curDif = ansDif;
    int step = n;
    int last = ansDig;

    while(step > 1){
        int temp = mark[step][curDif][last];
        res.push_back(temp);
        step--;
        curDif = abs(last - curDif);
        last = temp;
    }
    reverse(res.begin(), res.end());

    cout<<"YES\n";

    for(auto i : res)
        cout<<i<<" ";
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
int n;
int dp[1001][11][11];
pair<int, int> mark[1001][11][11];
int main(){
    cin>>s>>n;

    for(int x=0;x<10;x++){
        if(s[x] == '1'){
            dp[1][x+1][x+1] = 1;
        }
    }

    for(int x=2;x<=n;x++){
        for(int y = 1;y<=9;y++){
            for(int z= 1; z<=10; z++){
                if(s[z-1] == '0' || y >= z) continue;
                for(int a = 1; a<=10; a++){
                    if(a == z ) continue;

                    if(dp[x-1][z-y][a]){
                        dp[x][y][z] = 1;
                        mark[x][y][z].first = z-y;
                        mark[x][y][z].second = a;
                        break;
                    }
                }
            }
        }
    }
    bool found = false;
    int curDif, curDig;
    for(int x=1;x<=9;x++){
        for(int z=1;z<=10;z++){
            if(dp[n][x][z]){
                found = true;
                curDif = x;
                curDig = z;
                break;
            }
        }
    }
    if(!found) return cout<<"NO\n",0;

    vector<int> ans;
    ans.push_back(curDig);
    int step = n;
    while(step > 1){
        ans.push_back(mark[step][curDif][curDig].second);
        int temp = curDif;
        curDif = mark[step][curDif][curDig].first;
        curDig = mark[step][temp][curDig].second;
        step--;
    }
    cout<<"YES\n";
    reverse(ans.begin(), ans.end());
    for(auto i : ans)
        cout<<i<<" ";
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
int n;
int dp[1001][11][11];
int mark[1001][11][11];
int rec(int step, int dif, int last){
    if(dp[step][dif][last] != -1)
        return dp[step][dif][last];

    if(step <= 0)
        return 0;

    int ok = 0;
    for(int x=0;x<10;x++){
        if(s[x] == '1' && x+1 != last){
            if(dif - last == 0) continue;
            int cur = rec(step-1, abs(dif-last), x+1);
            if(cur){
                ok = cur;
                mark[step][dif][last] = x+1;
                break;
            }
        }
    }
    return dp[step][dif][last] = ok;
}
int main(){
    memset(dp, -1, sizeof dp);
    cin>>s>>n;

    if(n == 1){
        cout<<"YES\n";
        for(int x=0;x<10;x++){
            if(s[x] == '1'){
                cout<<x+1;
                return 0;
            }
        }
    }
    for(int x=0;x<10;x++){
        if(s[x] == '1'){
            dp[1][x+1][x+1] = 1;
        }
    }

    int isPossible = false;
    int ansDif, ansDig;
    for(int x=0;x<10;x++){
        if(s[x] == '1'){
            for(int y=1;y<x+1;y++){
                if(y-x-1 == 0) continue;
                int cur = rec(n, abs(y-x-1), x+1);
                if(cur){
                    isPossible = 1;
                    ansDif =abs( y-x-1);
                    ansDig = x+1;
                    break;
                }
            }

        }
    }
    if(!isPossible){
        cout<<"NO\n";
        return 0;
    }
    //cout<<mark[2][2][10]<<endl;
    vector<int> res;
    res.push_back(ansDig);
    int curDif = ansDif;
    int step = n;
    int last = ansDig;

    while(step > 1){
        int temp = mark[step][curDif][last];
        res.push_back(temp);
        step--;
        curDif = abs(last - curDif);
        last = temp;
    }
    reverse(res.begin(), res.end());

    cout<<"YES\n";

    for(auto i : res)
        cout<<i<<" ";
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
int n;
int dp[1001][11][11];
int mark[1001][11][11];
int rec(int step, int dif, int last){
    if(dp[step][dif][last] != -1)
        return dp[step][dif][last];

    if(step <= 0)
        return 0;

    int ok = 0;
    for(int x=0;x<10;x++){
        if(s[x] == '1' && x+1 != last){
            int cur = rec(step-1, abs(dif-last), x+1);
            if(cur){
                ok = cur;
                mark[step][dif][last] = x+1;
                break;
            }
        }
    }
    return dp[step][dif][last] = ok;
}
int main(){
    memset(dp, -1, sizeof dp);
    cin>>s>>n;

    if(n == 1){
        cout<<"YES\n";
        for(int x=0;x<10;x++){
            if(s[x] == '1'){
                cout<<x+1;
                return 0;
            }
        }
    }
    for(int x=0;x<10;x++){
        if(s[x] == '1'){
            dp[1][x+1][x+1] = 1;
        }
    }

    int isPossible = false;
    int ansDif, ansDig;
    for(int x=0;x<10;x++){
        if(s[x] == '1'){
            for(int y=1;y<x+1;y++){
                int cur = rec(n, abs(y-x-1), x+1);
                if(cur){
                    isPossible = 1;
                    ansDif =abs( y-x-1);
                    ansDig = x+1;
                    break;
                }
            }

        }
    }
    if(!isPossible){
        cout<<"NO\n";
        return 0;
    }
    //cout<<mark[2][2][10]<<endl;
    vector<int> res;
    res.push_back(ansDig);
    int curDif = ansDif;
    int step = n;
    int last = ansDig;

    while(step > 1){
        int temp = mark[step][curDif][last];
        res.push_back(temp);
        step--;
        curDif = abs(last - curDif);
        last = temp;
    }
    reverse(res.begin(), res.end());

    cout<<"YES\n";

    for(auto i : res)
        cout<<i<<" ";
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
int n;
int dp[1001][11][11];
pair<int, int> mark[1001][11][11];
int main(){
    cin>>s>>n;
    bool hasDi = false;
    for(int x=0;x<10;x++){
        if(s[x] == '1') hasDi = true;
    }
    if(!hasDi){
        cout<<"NO\n";
        return 0;
    }
    if(n == 1){
        cout<<"YES\n";
        for(int x=0;x<10;x++){
            if(s[x] == '1'){
                cout<<x+1;
                return 0;
            }
        }
    }
    for(int x=0;x<10;x++){
        if(s[x] == '1'){
            dp[1][x+1][x+1] = 1;
        }
    }

    for(int x=2;x<=n;x++){
        for(int y = 1;y<=9;y++){
            for(int z= 1; z<=10; z++){
                if(s[z-1] == '0' || y >= z) continue;
                for(int a = 1; a<=10; a++){
                    if(a == z ) continue;

                    if(dp[x-1][z-y][a]){
                        dp[x][y][z] = 1;
                        mark[x][y][z].first = z-y;
                        mark[x][y][z].second = a;
                        break;
                    }
                }
            }
        }
    }
    bool found = false;
    int curDif, curDig;
    for(int x=1;x<=9;x++){
        for(int z=1;z<=10;z++){
            if(dp[n][x][z]){
                found = true;
                curDif = x;
                curDig = z;
                break;
            }
        }
    }
    if(!found) return cout<<"NO\n",0;

    vector<int> ans;
    ans.push_back(curDig);
    int step = n;
    while(step > 1){
        ans.push_back(mark[step][curDif][curDig].second);
        int temp = curDif;
        curDif = mark[step][curDif][curDig].first;
        curDig = mark[step][temp][curDig].second;
        step--;
    }
    cout<<"YES\n";
    reverse(ans.begin(), ans.end());
    for(auto i : ans)
        cout<<i<<" ";
}


#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <stack>

#define mp make_pair
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<int> vi;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    char ch;
    bool av[10];
    for(int i=0;i<10;i++){
        cin >> ch;
        av[i] = ch=='1';
    }
    cin >> n;
    pair<int,int> dp[1005][10];
    for(int i=0;i<n;i++)
        for(int j = 0;j<10;j++)
            dp[i][j] = mp(-100,-1);
    for(int i=0;i<10;i++)
        if(av[i])
            dp[0][i] = mp(i+1,-1);
    for(int i=1;i<n;i++)
        for(int j=0;j<10;j++)
            for(int k = 0;k<10;k++)
                if(k!=j && av[k] && av[j] &&
                        abs(dp[i-1][j].F)<k+1){
                    dp[i][k] = mp(dp[i-1][j].F + (i%2==0?1:-1) * (k+1),j);
                    break;
                }
    int x = -1;
    for(int i=0;i<10;i++)
        if(abs(dp[n-1][i].F)<=10){
           x = i;
           break;
        }
    if(x==-1)
        cout << "NO" << endl;
    else {
        cout << "YES" << endl;
        stack<int> s;
        s.push(x);
        x = dp[--n][x].S;
        while(x!=-1){
            s.push(x);
            x = dp[--n][x].S;
        }
        while(s.size()){
            int w = s.top();s.pop();
            cout << w+1 << " ";
        }
        cout << endl;
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <stack>

#define mp make_pair
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<int> vi;

pii dp[1005][20];
bool av[20];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    char ch;
    for(int i=0;i<10;i++){
        cin >> ch;
        av[i+1] = ch=='1';
    }
    cin >> n;

    for(int i=1;i<=10;i++)
        dp[0][i] = mp(av[i] ? i : 100,-1);

    for(int i=1;i<n;i++){
        fill(dp[i],dp[i]+15,mp(100,-1));
        for(int j = 1;j<=10;j++){
            if(!av[j]) continue;
            for(int k = 1;k<=10;k++)
                if(dp[i-1][k].F < j && k!=j )
                    dp[i][j] = min(dp[i][j],mp(j-dp[i-1][k].F,k));
        }
    }

    for(int i=1;i<=10;i++){
        if(dp[n-1][i].F >15 ) continue;

        cout << "YES" << endl;
        int w = n,k = i;

        stack <int > s;

        while(k>0){
            s.push(k);
            k = dp[--w][k].S;
        }

        while(s.size()){
            cout << s.top() << " ";
            s.pop();
        }

        cout << endl;

        return 0;
    }
    cout << "NO" << endl;
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <stack>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<int> vi;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    char ch;
    bool av[10];
    for(int i=0;i<10;i++){
        cin >> ch;
        av[i] = ch=='1';
    }
    cin >> n;
    int dp[n][10];
    for(int i=0;i<n;i++)
        for(int j = 0;j<10;j++)
            dp[i][j] = -100;
    for(int i=0;i<10;i++)
        dp[0][i] = i+1;
    for(int i=1;i<n;i++)
        for(int j=0;j<10;j++)
            for(int k = abs(dp[i-1][j]);k<10;k++)
                if(k!=j && av[k])
                    dp[i][k] = dp[i-1][j] + (i%2==0?1:-1) * (k+1);
    int x = -1;
    for(int i=0;i<10;i++)
        if(abs(dp[n-1][i])<10){
           x = i;
           break;
        }
    if(x==-1)
        cout << "NO" << endl;
    else {
        cout << "YES" << endl;
        stack<int> s;
        x = -1;
        while(n--){
            for(int w = 0;w<10;w++)
                if(av[w] && dp[n][w] != -100 && w!=x){
                    s.push(w);
                    x = w;
                    break;
                }
        }
        while(s.size()){
            int w = s.top();s.pop();
            cout << w+1 << " ";
        }
        cout << endl;
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <stack>

#define mp make_pair
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<int> vi;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    char ch;
    bool av[10];
    for(int i=0;i<10;i++){
        cin >> ch;
        av[i] = ch=='1';
    }
    cin >> n;
    pair<int,int> dp[1005][10];
    for(int i=0;i<n;i++)
        for(int j = 0;j<10;j++)
            dp[i][j] = mp(-100,-1);
    for(int i=0;i<10;i++)
        dp[0][i] = mp(i+1,-1);
    for(int i=1;i<n;i++)
        for(int j=0;j<10;j++)
            for(int k = 0;k<10;k++)
                if(k!=j && av[k] && av[j] &&
                        abs(dp[i-1][j].F)<k+1){
                    dp[i][k] = mp(dp[i-1][j].F + (i%2==0?1:-1) * (k+1),j);
                    break;
                }
    int x = -1;
    for(int i=0;i<10;i++)
        if(abs(dp[n-1][i].F)<10){
           x = i;
           break;
        }
    if(x==-1)
        cout << "NO" << endl;
    else {
        cout << "YES" << endl;
        stack<int> s;
        s.push(x);
        x = dp[--n][x].S;
        while(x!=-1){
            s.push(x);
            x = dp[--n][x].S;
        }
        while(s.size()){
            int w = s.top();s.pop();
            cout << w+1 << " ";
        }
        cout << endl;
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <stack>

#define mp make_pair
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<int> vi;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    char ch;
    bool av[10];
    for(int i=0;i<10;i++){
        cin >> ch;
        av[i] = ch=='1';
    }
    cin >> n;
    pair<int,int> dp[1005][10];
    for(int i=0;i<n;i++)
        for(int j = 0;j<10;j++)
            dp[i][j] = mp(-100,-1);
    for(int i=0;i<10;i++)
        if(av[i])
            dp[0][i] = mp(i+1,-1);
    for(int i=1;i<n;i++)
        for(int k = 0;k<10;k++)
            for(int j=0;j<10;j++)
                if(k!=j && av[k] && av[j] &&
                        abs(dp[i-1][j].F)<k+1){
                    dp[i][k] = mp(dp[i-1][j].F + (i%2==0?1:-1) * (k+1),j);
                    break;
                }
    int x = -1;
    for(int i=0;i<10;i++)
        if(abs(dp[n-1][i].F)<=10){
           x = i;
           break;
        }
    if(x==-1)
        cout << "NO" << endl;
    else {
        cout << "YES" << endl;
        stack<int> s;
        s.push(x);
        x = dp[--n][x].S;
        while(x!=-1){
            s.push(x);
            x = dp[--n][x].S;
        }
        while(s.size()){
            int w = s.top();s.pop();
            cout << w+1 << " ";
        }
        cout << endl;
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <stack>

#define mp make_pair
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<int> vi;

pii dp[1000][20];
bool av[20];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    char ch;
    for(int i=0;i<10;i++){
        cin >> ch;
        av[i+1] = ch=='1';
    }
    cin >> n;

    for(int i=1;i<=10;i++)
        dp[0][i] = mp(i,-1);

    for(int i=1;i<n;i++){
        fill(dp[i],dp[i]+10,mp(0,-1));
        for(int j = 1;j<=10;j++)
            for(int k = 1;k<=10;k++)
                if(dp[i-1][k].F < j  && av[j] && av[k] && k!=j ){
                    dp[i][j] = mp(j-dp[i-1][k].F,k);
                    break;
                }
    }

    for(int i=1;i<=10;i++){
        if(dp[n-1][i].F <= 0 ) continue;

        cout << "YES" << endl;
        int w = n,k = i;

        while(k>0){
            cout << k << " ";
            w--;k = dp[w][k].S;
        }

        cout << endl;

        return 0;
    }
    cout << "NO" << endl;
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <stack>

#define mp make_pair
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<int> vi;

bool mark[20][20][1005],av[20];

bool dfs(pair<pii,int>x,stack<int>*s,int n){
    if(x.S==n) {
        s->push(x.F.S);
        return true;
    }
    mark[x.F.F][x.F.S][x.S] = true;
    for(int i=x.F.F+1;i<11;i++)
        if(av[i] && i!= x.F.S)// && !mark[i-x.F.F][i][x.S])
            if(dfs(mp(mp(i-x.F.F,i),x.S+1),s,n)){
                s->push(x.F.S);
                return true;
            }
    return false;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    char ch;
    for(int i=0;i<10;i++){
        cin >> ch;
        av[i+1] = ch=='1';
    }
    cin >> n;
    stack<int> s;
    if(dfs(mp(mp(0,0),0),&s,n))
    {
        cout << "YES" << endl;
        s.pop();
        while(s.size()){
            cout << s.top() << " ";
            s.pop();
        }
        cout << endl;
    } else
        cout << "NO" << endl;
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <stack>

#define mp make_pair
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<int> vi;

pii dp[1005][20];
bool av[20];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    char ch;
    for(int i=0;i<10;i++){
        cin >> ch;
        av[i+1] = ch=='1';
    }
    cin >> n;

    for(int i=1;i<=10;i++)
        dp[0][i] = mp(av[i] ? i : -10,-1);

    for(int i=1;i<n;i++){
        fill(dp[i],dp[i]+15,mp(-10,-1));
        for(int j = 1;j<=10;j++)
            for(int k = 1;k<=10;k++)
                if(dp[i-1][k].F < j && dp[i-1][k].F >0
                        && av[j] && av[k] && k!=j ){
                    dp[i][j] = mp(j-dp[i-1][k].F,k);
                    break;
                }
    }

    for(int i=1;i<=10;i++){
        if(dp[n-1][i].F <= 0 ) continue;

        cout << "YES" << endl;
        int w = n,k = i;

        stack <int > s;

        while(k>0){
            s.push(k);
            k = dp[--w][k].S;
        }

        while(s.size()){
            cout << s.top() << " ";
            s.pop();
        }

        cout << endl;

        return 0;
    }
    cout << "NO" << endl;
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <stack>

#define mp make_pair
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<int> vi;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    char ch;
    bool av[10];
    for(int i=0;i<10;i++){
        cin >> ch;
        av[i] = ch=='1';
    }
    cin >> n;
    pair<int,int> dp[1005][10];
    for(int i=0;i<n;i++)
        for(int j = 0;j<10;j++)
            dp[i][j] = mp(-100,-1);
    for(int i=0;i<10;i++)
        if(av[i])
            dp[0][i] = mp(i+1,-1);
    for(int i=1;i<n;i++)
        for(int k = 0;k<10;k++)
            for(int j=0;j<10;j++)
                if(k!=j && av[k] && av[j] &&
                        abs(dp[i-1][j].F)<k+1)
                    dp[i][k] = abs(dp[i][k].F) >
                        dp[i-1][j].F + (i%2==0?1:-1) * (k+1) ?
                            mp(dp[i-1][j].F + (i%2==0?1:-1) * (k+1),j) :
                            dp[i][k];
    int x = -1;
    for(int i=0;i<10;i++)
        if(abs(dp[n-1][i].F)<=10){
           x = i;
           break;
        }
    if(x==-1)
        cout << "NO" << endl;
    else {
        cout << "YES" << endl;
        stack<int> s;
        s.push(x);
        x = dp[--n][x].S;
        while(x!=-1){
            s.push(x);
            x = dp[--n][x].S;
        }
        while(s.size()){
            int w = s.top();s.pop();
            cout << w+1 << " ";
        }
        cout << endl;
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <stack>

#define mp make_pair
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<int> vi;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    char ch;
    bool av[10];
    for(int i=0;i<10;i++){
        cin >> ch;
        av[i] = ch=='1';
    }
    cin >> n;
    pair<int,int> dp[1005][10];
    for(int i=0;i<n;i++)
        for(int j = 0;j<10;j++)
            dp[i][j] = mp(-100,-1);
    for(int i=0;i<10;i++)
        if(av[i])
            dp[0][i] = mp(i+1,-1);
    for(int i=1;i<n;i++)
        for(int j=0;j<10;j++)
            for(int k = 0;k<10;k++)
                if(k!=j && av[k] && av[j] &&
                        abs(dp[i-1][j].F)<k+1){
                    dp[i][k] = mp(dp[i-1][j].F + (i%2==0?1:-1) * (k+1),j);
                    break;
                }
    int x = -1;
    for(int i=0;i<10;i++)
        if(abs(dp[n-1][i].F)<10){
           x = i;
           break;
        }
    if(x==-1)
        cout << "NO" << endl;
    else {
        cout << "YES" << endl;
        stack<int> s;
        s.push(x);
        x = dp[--n][x].S;
        while(x!=-1){
            s.push(x);
            x = dp[--n][x].S;
        }
        while(s.size()){
            int w = s.top();s.pop();
            cout << w+1 << " ";
        }
        cout << endl;
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <stack>

#define mp make_pair
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<int> vi;

bool mark[20][20][1005],av[20];

bool dfs(pair<pii,int>x,stack<int>*s,int n){
    if(x.S==n) {
        s->push(x.F.S);
        return true;
    }
    mark[x.F.F][x.F.S][x.S] = true;
    for(int i=x.F.F+1;i<11;i++)
        if(av[i] && i!= x.F.S && !mark[i-x.F.F][i][x.S])
            if(dfs(mp(mp(i-x.F.F,i),x.S+1),s,n)){
                s->push(x.F.S);
                return true;
            }
    return false;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    char ch;
    for(int i=0;i<10;i++){
        cin >> ch;
        av[i+1] = ch=='1';
    }
    cin >> n;
    stack<int> s;
    if(dfs(mp(mp(0,0),0),&s,n))
    {
        s.pop();
        while(s.size()){
            cout << s.top() << " ";
            s.pop();
        }
        cout << endl;
    } else
        cout << "NO" << endl;
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <stack>

#define mp make_pair
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<int> vi;

bool mark[20][20][1005],av[20];

bool dfs(pair<pii,int>x,stack<int>*s,int n){
    if(x.S==n) {
        s->push(x.F.S);
        return true;
    }
    mark[x.F.F][x.F.S][x.S] = true;
    for(int i=x.F.F+1;i<11;i++)
        if(av[i] && i!= x.F.S && !mark[i-x.F.F][i][x.S])
            if(dfs(mp(mp(i-x.F.F,i),x.S+1),s,n)){
                s->push(x.F.S);
                return true;
            }
    return false;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    char ch;
    for(int i=0;i<10;i++){
        cin >> ch;
        av[i+1] = ch=='1';
    }
    cin >> n;
    stack<int> s;
    if(dfs(mp(mp(0,0),0),&s,n))
    {
        cout << "YES" << endl;
        s.pop();
        while(s.size()){
            cout << s.top() << " ";
            s.pop();
        }
        cout << endl;
    } else
        cout << "NO" << endl;
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <stack>

#define mp make_pair
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<int> vi;

pii dp[1005][20];
bool av[20];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    char ch;
    for(int i=0;i<10;i++){
        cin >> ch;
        av[i+1] = ch=='1';
    }
    cin >> n;

    for(int i=1;i<=10;i++)
        dp[0][i] = mp(i,-1);

    for(int i=1;i<n;i++){
        fill(dp[i],dp[i]+15,mp(-10,-1));
        for(int j = 1;j<=10;j++)
            for(int k = 1;k<=10;k++)
                if(dp[i-1][k].F < j && dp[i-1][k].F >0
                        && av[j] && av[k] && k!=j ){
                    dp[i][j] = mp(j-dp[i-1][k].F,k);
                    break;
                }
    }

    for(int i=1;i<=10;i++){
        if(dp[n-1][i].F <= 0 ) continue;

        cout << "YES" << endl;
        int w = n,k = i;

        while(k>0){
            cout << k << " ";
            w--;k = dp[w][k].S;
        }

        cout << endl;

        return 0;
    }
    cout << "NO" << endl;
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <stack>

#define mp make_pair
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<int> vi;

pii dp[1000][20];
bool av[20];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    char ch;
    for(int i=0;i<10;i++){
        cin >> ch;
        av[i+1] = ch=='1';
    }
    cin >> n;

    for(int i=1;i<=10;i++)
        dp[0][i] = mp(i,-1);

    for(int i=1;i<n;i++){
        fill(dp[i],dp[i]+10,mp(0,-1));
        for(int j = 1;j<=10;j++)
            for(int k = 1;k<=10;k++)
                if(dp[i-1][k].F < j  && av[j] && av[k] && k!=j ){
                    dp[i][j] = mp(j-dp[i-1][k].F,k);
                    break;
                }
    }

    for(int i=1;i<=10;i++){
        if(dp[n-1][i].F <= 0 || dp[n-1][i].S <0) continue;

        cout << "YES" << endl;
        int w = n,k = i;

        while(k>0){
            cout << k << " ";
            w--;k = dp[w][k].S;
        }

        cout << endl;

        return 0;
    }
    cout << "NO" << endl;
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <stack>

#define mp make_pair
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<int> vi;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    char ch;
    bool av[10];
    for(int i=0;i<10;i++){
        cin >> ch;
        av[i] = ch=='1';
    }
    cin >> n;
    pair<int,int> dp[1005][10];
    for(int i=0;i<n;i++)
        for(int j = 0;j<10;j++)
            dp[i][j] = mp(-100,-1);
    for(int i=0;i<10;i++)
        dp[0][i] = mp(i+1,-1);
    for(int i=1;i<n;i++)
        for(int j=0;j<10;j++)
            for(int k = abs(dp[i-1][j].F);k<10;k++)
                if(k!=j && av[k] && av[j])
                    dp[i][k] = mp(dp[i-1][j].F + (i%2==0?1:-1) * (k+1),j);
    int x = -1;
    for(int i=0;i<10;i++)
        if(abs(dp[n-1][i].F)<10){
           x = i;
           break;
        }
    if(x==-1)
        cout << "NO" << endl;
    else {
        cout << "YES" << endl;
        stack<int> s;
        s.push(x);
        x = dp[--n][x].S;
        while(x!=-1){
            s.push(x);
            x = dp[--n][x].S;
        }
        while(s.size()){
            int w = s.top();s.pop();
            cout << w+1 << " ";
        }
        cout << endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const ll MOD=1e9+7;
bool IsPowerOfTwo(ll x){ return (x != 0) && ((x & (x - 1)) == 0);}
ll poer(ll a,ll b){ll rs=1; while(b>0) { if(b&1) rs*=a; a*=a; b/=2;} return rs;}
ll mod_poer(ll a,ll b,ll mo){ll rs=1; while(b>0) { if(b&1) rs=(rs*a)%mo; a=(a*a)%mo; b/=2;} return rs%mo;}
ll d,x,y;
void ext_euclid(ll a,ll b){ if(b==0){d=a;x=1;y=0;}else{ext_euclid(b,a%b);ll temp=x;x=y;y=temp-(a/b)*y;}}
ll mod_inverse1(ll a,ll m){ext_euclid(a,m);return (x%m+m)%m;}
ll mod_inverse2(ll a,ll m){return mod_poer(a,m-2,m);}
ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}

// never take ll as return type of find operation in strings
// never take d,x,y as variables........

int n,m,i,j;
char s[11];
vector<int> result;
int flag;
/*void dfs(int prev , int current , int steps)
{
    if(flag==1)
        return;

    if(steps == m)
    {
        flag=1;
        cout<<"YES\n";
        for(int i=0; i<result.size(); i++)
            cout<<result[i]<<" ";
        cout<<"\n";
        return ;
    }

        for(int i=current+1; i<=10; i++)
        {
            if(s[i]=='1' and prev!=i)
            {
                result.push_back(i);
                dfs(i, i-current, steps+1);
            }
        }

}
*/
void dfs(int prev,int cr,int k)
{
	int i;
	if(flag)return;
	if(k==m)
	{
		flag=1;
		cout<<"YES"<<endl;
		for(i=0;i<m;i++)cout<<result[i]<<" ";
		cout<<endl;
		return;
	}
	for(i=cr+1;i<=10;i++)
	 if(s[i]=='1' && prev!=i)
	 {
	 	result[k+1]=i;
	 	dfs(i,i-cr,k+1);
	 }
}
int main()
{

    cin>>(s+1);
    cin>>m;
    dfs(0,0,0);

    if(flag==0)
        cout<<"NO\n";

       return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const ll MOD=1e9+7;
bool IsPowerOfTwo(ll x){ return (x != 0) && ((x & (x - 1)) == 0);}
ll poer(ll a,ll b){ll rs=1; while(b>0) { if(b&1) rs*=a; a*=a; b/=2;} return rs;}
ll mod_poer(ll a,ll b,ll mo){ll rs=1; while(b>0) { if(b&1) rs=(rs*a)%mo; a=(a*a)%mo; b/=2;} return rs%mo;}
ll d,x,y;
void ext_euclid(ll a,ll b){ if(b==0){d=a;x=1;y=0;}else{ext_euclid(b,a%b);ll temp=x;x=y;y=temp-(a/b)*y;}}
ll mod_inverse1(ll a,ll m){ext_euclid(a,m);return (x%m+m)%m;}
ll mod_inverse2(ll a,ll m){return mod_poer(a,m-2,m);}
ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}

// never take ll as return type of find operation in strings
// never take d,x,y as variables........

int n,m,i,j;
char s[11];
vector<int> result;
int flag;
void dfs(int prev , int current , int steps)
{
    if(flag==1)
        return;

    if(steps == m)
    {
        flag=1;
        cout<<"YES\n";
        for(int i=0; i<result.size(); i++)
            cout<<result[i]<<" ";
        cout<<"\n";
        return ;
    }

        for(int i=current+1; i<=10; i++)
        {
            if(s[i]=='1' and prev!=i)
            {
                result.push_back(i);
                dfs(i, i-current, steps+1);
            }
        }

}
int main()
{

    cin>>s+1;
    cin>>m;
    dfs(0,0,0);

    if(flag==0)
        cout<<"NO\n";

       return 0;
}


#include <iostream>
using namespace std;
int m,ans[1001],f;
char s[11];
void dfs(int prev,int cr,int k)
{
	int i;
	if(f)return;
	if(k==m)
	{
		f=1;
		cout<<"YES"<<endl;
		for(i=1;i<=m;i++)cout<<ans[i]<<" ";
		cout<<endl;
		return;
	}
	for(i=cr+1;i<=10;i++)
	 if(s[i]=='1' && prev!=i)
	 {
	 	ans[k+1]=i;
	 	dfs(i,i-cr,k+1);
	 }
}
int main()
{
	cin>>s+1>>m;
	dfs(0,0,0);
	if(!f)cout<<"NO"<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const ll MOD=1e9+7;
bool IsPowerOfTwo(ll x){ return (x != 0) && ((x & (x - 1)) == 0);}
ll poer(ll a,ll b){ll rs=1; while(b>0) { if(b&1) rs*=a; a*=a; b/=2;} return rs;}
ll mod_poer(ll a,ll b,ll mo){ll rs=1; while(b>0) { if(b&1) rs=(rs*a)%mo; a=(a*a)%mo; b/=2;} return rs%mo;}
ll d,x,y;
void ext_euclid(ll a,ll b){ if(b==0){d=a;x=1;y=0;}else{ext_euclid(b,a%b);ll temp=x;x=y;y=temp-(a/b)*y;}}
ll mod_inverse1(ll a,ll m){ext_euclid(a,m);return (x%m+m)%m;}
ll mod_inverse2(ll a,ll m){return mod_poer(a,m-2,m);}
ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}

// never take ll as return type of find operation in strings
// never take d,x,y as variables........

int n,m,i,j;
int main()
{
    string s;
    cin>>s;
    cin>>m;
    vector<int> wt;
    vector<int> result;

    for(i=0; i<s.length(); i++)
    {
        if(s[i]=='1')
            wt.push_back(i+1);
    }

    if(wt.size()==1 and m>1)
    {
        cout<<"NO\n";
        return 0;
    }
    else
    {
       ll xx=0,yy=0;
        int flag=0;
        int counter = 0;
        while(m>0)
        {
            if(flag==0)
            {
            xx += wt[counter];
            if(xx<=yy)
            {
                cout<<"NO\n";
                return 0;
            }
            }
            else
            {

              yy += wt[counter];
            if(yy<=xx)
            {
                cout<<"NO\n";
                return 0;
            }

            }

            result.push_back(wt[counter]);
            m--;
            counter = (counter+1)%wt.size();
            flag = (!flag);

        }

        cout<<"YES\n";

        for(i=0; i<result.size(); i++)
            cout<<result[i]<<" ";
        cout<<"\n";
    }
       return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const ll MOD=1e9+7;
bool IsPowerOfTwo(ll x){ return (x != 0) && ((x & (x - 1)) == 0);}
ll poer(ll a,ll b){ll rs=1; while(b>0) { if(b&1) rs*=a; a*=a; b/=2;} return rs;}
ll mod_poer(ll a,ll b,ll mo){ll rs=1; while(b>0) { if(b&1) rs=(rs*a)%mo; a=(a*a)%mo; b/=2;} return rs%mo;}
ll d,x,y;
void ext_euclid(ll a,ll b){ if(b==0){d=a;x=1;y=0;}else{ext_euclid(b,a%b);ll temp=x;x=y;y=temp-(a/b)*y;}}
ll mod_inverse1(ll a,ll m){ext_euclid(a,m);return (x%m+m)%m;}
ll mod_inverse2(ll a,ll m){return mod_poer(a,m-2,m);}
ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}

// never take ll as return type of find operation in strings
// never take d,x,y as variables........

int n,m,i,j;
int main()
{
    string s;
    cin>>s;
    cin>>m;
    vector<int> wt;
    vector<int> result;

    for(i=0; i<s.length(); i++)
    {
        if(s[i]=='1')
            wt.push_back(i+1);
    }

    if(wt.size()==1 and m>1)
    {
        cout<<"NO\n";
        return 0;
    }
    else
    {
       ll xx=0,yy=0;
        int flag=0;
        int counter = 0;
        while(m>0)
        {
            if(flag==0)
            {

            xx += wt[counter];
            if(xx<=yy)
            {
                xx = xx- wt[counter];
                int temp = counter;
                counter = (counter+1)%wt.size();

                while(xx + wt[counter] <= yy and counter!=temp)
                  counter = (counter+1)%wt.size();

               if(counter == temp)
                {
                 cout<<"NO\n";
                 return 0;
                }
                else
                    xx += wt[counter];

            }
            }
            else
            {

              yy += wt[counter];
            if(yy<=xx)
            {
                yy = yy- wt[counter];
                int temp = counter;
                counter = (counter+1)%wt.size();

                while(yy + wt[counter] <= xx and counter!=temp)
                  counter = (counter+1)%wt.size();

               if(counter == temp)
                {
                 cout<<"NO\n";
                 return 0;
                }
                else
                    yy += wt[counter];
            }

            }

            result.push_back(wt[counter]);
            m--;
            counter = (counter+1)%wt.size();
            flag = (!flag);

        }

        cout<<"YES\n";

        for(i=0; i<result.size(); i++)
            cout<<result[i]<<" ";
        cout<<"\n";
    }
       return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const ll MOD=1e9+7;
bool IsPowerOfTwo(ll x){ return (x != 0) && ((x & (x - 1)) == 0);}
ll poer(ll a,ll b){ll rs=1; while(b>0) { if(b&1) rs*=a; a*=a; b/=2;} return rs;}
ll mod_poer(ll a,ll b,ll mo){ll rs=1; while(b>0) { if(b&1) rs=(rs*a)%mo; a=(a*a)%mo; b/=2;} return rs%mo;}
ll d,x,y;
void ext_euclid(ll a,ll b){ if(b==0){d=a;x=1;y=0;}else{ext_euclid(b,a%b);ll temp=x;x=y;y=temp-(a/b)*y;}}
ll mod_inverse1(ll a,ll m){ext_euclid(a,m);return (x%m+m)%m;}
ll mod_inverse2(ll a,ll m){return mod_poer(a,m-2,m);}
ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}

// never take ll as return type of find operation in strings
// never take d,x,y as variables........

int n,m,i,j;
char s[11];
int result[10001];
int flag;
/*void dfs(int prev , int current , int steps)
{
    if(flag==1)
        return;

    if(steps == m)
    {
        flag=1;
        cout<<"YES\n";
        for(int i=0; i<result.size(); i++)
            cout<<result[i]<<" ";
        cout<<"\n";
        return ;
    }

        for(int i=current+1; i<=10; i++)
        {
            if(s[i]=='1' and prev!=i)
            {
                result.push_back(i);
                dfs(i, i-current, steps+1);
            }
        }

}
*/
void dfs(int prev,int cr,int k)
{
	int i;
	if(flag)return;
	if(k==m)
	{
		flag=1;
		cout<<"YES"<<endl;
		for(i=1;i<=m;i++)cout<<result[i]<<" ";
		cout<<endl;
		return;
	}
	for(i=cr+1;i<=10;i++)
	 if(s[i]=='1' && prev!=i)
	 {
	 	result[k+1]=i;
	 	dfs(i,i-cr,k+1);
	 }
}
int main()
{

    cin>>(s+1);
    cin>>m;
    dfs(0,0,0);

    if(flag==0)
        cout<<"NO\n";

       return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const ll MOD=1e9+7;
bool IsPowerOfTwo(ll x){ return (x != 0) && ((x & (x - 1)) == 0);}
ll poer(ll a,ll b){ll rs=1; while(b>0) { if(b&1) rs*=a; a*=a; b/=2;} return rs;}
ll mod_poer(ll a,ll b,ll mo){ll rs=1; while(b>0) { if(b&1) rs=(rs*a)%mo; a=(a*a)%mo; b/=2;} return rs%mo;}
ll d,x,y;
void ext_euclid(ll a,ll b){ if(b==0){d=a;x=1;y=0;}else{ext_euclid(b,a%b);ll temp=x;x=y;y=temp-(a/b)*y;}}
ll mod_inverse1(ll a,ll m){ext_euclid(a,m);return (x%m+m)%m;}
ll mod_inverse2(ll a,ll m){return mod_poer(a,m-2,m);}
ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}

// never take ll as return type of find operation in strings
// never take d,x,y as variables........

int n,m,i,j;
char s[11];
vector<int> result;
int flag;
void dfs(int prev , int current , int steps)
{
    if(flag==1)
        return;

    if(steps == m)
    {
        flag=1;
        cout<<"YES\n";
        for(int i=0; i<result.size(); i++)
            cout<<result[i]<<" ";
        cout<<"\n";
        return ;
    }
    else
    {
        for(int i=current+1; i<=10; i++)
        {
            if(s[i]=='1' and prev!=i)
            {
                result.push_back(i);
                dfs(i, i-current, steps+1);
            }
        }
    }

}
int main()
{

    cin>>s+1;
    cin>>m;
    dfs(0,0,0);

    if(flag==0)
        cout<<"NO\n";

       return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const ll MOD=1e9+7;
bool IsPowerOfTwo(ll x){ return (x != 0) && ((x & (x - 1)) == 0);}
ll poer(ll a,ll b){ll rs=1; while(b>0) { if(b&1) rs*=a; a*=a; b/=2;} return rs;}
ll mod_poer(ll a,ll b,ll mo){ll rs=1; while(b>0) { if(b&1) rs=(rs*a)%mo; a=(a*a)%mo; b/=2;} return rs%mo;}
ll d,x,y;
void ext_euclid(ll a,ll b){ if(b==0){d=a;x=1;y=0;}else{ext_euclid(b,a%b);ll temp=x;x=y;y=temp-(a/b)*y;}}
ll mod_inverse1(ll a,ll m){ext_euclid(a,m);return (x%m+m)%m;}
ll mod_inverse2(ll a,ll m){return mod_poer(a,m-2,m);}
ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}

// never take ll as return type of find operation in strings
// never take d,x,y as variables........

int n,m,i,j;
int main()
{
    string s;
    cin>>s;
    cin>>m;
    vector<int> wt;
    vector<int> result;

    for(i=0; i<s.length(); i++)
    {
        if(s[i]=='1')
            wt.push_back(i+1);
    }

    if(wt.size()==1 and m>1)
    {
        cout<<"NO\n";
        return 0;
    }
    else
    {
       ll xx=0,yy=0;
        int flag=0;
        int counter = 0;
        while(m>0)
        {
            if(flag==0)
            {

            xx += wt[counter];
            if(xx<=yy)
            {
                xx = xx- wt[counter];
                int temp = counter;
                counter = (counter+1)%wt.size();

                while(xx + wt[counter] <= yy and counter==temp)
                  counter = (counter+1)%wt.size();

               if(counter == temp  )
                {
                 cout<<"NO\n";
                 return 0;
                }
                else
                    xx += wt[counter];

            }
            }
            else
            {

              yy += wt[counter];
            if(yy<=xx)
            {
                yy = yy- wt[counter];
                int temp = counter;
                counter = (counter+1)%wt.size();

                while(yy + wt[counter] <= xx and counter==temp )
                  counter = (counter+1)%wt.size();

               if(counter == temp)
                {
                 cout<<"NO\n";
                 return 0;
                }
                else
                    yy += wt[counter];
            }

            }

            result.push_back(wt[counter]);
            m--;
            counter = (counter+1)%wt.size();
            flag = (!flag);

        }

        cout<<"YES\n";

        for(i=0; i<result.size(); i++)
            cout<<result[i]<<" ";
        cout<<"\n";
    }
       return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const ll MOD=1e9+7;
bool IsPowerOfTwo(ll x){ return (x != 0) && ((x & (x - 1)) == 0);}
ll poer(ll a,ll b){ll rs=1; while(b>0) { if(b&1) rs*=a; a*=a; b/=2;} return rs;}
ll mod_poer(ll a,ll b,ll mo){ll rs=1; while(b>0) { if(b&1) rs=(rs*a)%mo; a=(a*a)%mo; b/=2;} return rs%mo;}
ll d,x,y;
void ext_euclid(ll a,ll b){ if(b==0){d=a;x=1;y=0;}else{ext_euclid(b,a%b);ll temp=x;x=y;y=temp-(a/b)*y;}}
ll mod_inverse1(ll a,ll m){ext_euclid(a,m);return (x%m+m)%m;}
ll mod_inverse2(ll a,ll m){return mod_poer(a,m-2,m);}
ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}

// never take ll as return type of find operation in strings
// never take d,x,y as variables........

int n,m,i,j;
char s[11];
int result[10001];
int flag;
/*void dfs(int prev , int current , int steps)
{
    if(flag==1)
        return;

    if(steps == m)
    {
        flag=1;
        cout<<"YES\n";
        for(int i=0; i<result.size(); i++)
            cout<<result[i]<<" ";
        cout<<"\n";
        return ;
    }

        for(int i=current+1; i<=10; i++)
        {
            if(s[i]=='1' and prev!=i)
            {
                result.push_back(i);
                dfs(i, i-current, steps+1);
            }
        }

}
*/
void dfs(int prev,int cr,int k)
{
	int i;
	if(flag)return;
	if(k==m)
	{
		flag=1;
		cout<<"YES"<<endl;
		for(i=0;i<m;i++)cout<<result[i]<<" ";
		cout<<endl;
		return;
	}
	for(i=cr+1;i<=10;i++)
	 if(s[i]=='1' && prev!=i)
	 {
	 	result[k]=i;
	 	dfs(i,i-cr,k+1);
	 }
}
int main()
{

    cin>>(s+1);
    cin>>m;
    dfs(0,0,0);

    if(flag==0)
        cout<<"NO\n";

       return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const ll MOD=1e9+7;
bool IsPowerOfTwo(ll x){ return (x != 0) && ((x & (x - 1)) == 0);}
ll poer(ll a,ll b){ll rs=1; while(b>0) { if(b&1) rs*=a; a*=a; b/=2;} return rs;}
ll mod_poer(ll a,ll b,ll mo){ll rs=1; while(b>0) { if(b&1) rs=(rs*a)%mo; a=(a*a)%mo; b/=2;} return rs%mo;}
ll d,x,y;
void ext_euclid(ll a,ll b){ if(b==0){d=a;x=1;y=0;}else{ext_euclid(b,a%b);ll temp=x;x=y;y=temp-(a/b)*y;}}
ll mod_inverse1(ll a,ll m){ext_euclid(a,m);return (x%m+m)%m;}
ll mod_inverse2(ll a,ll m){return mod_poer(a,m-2,m);}
ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}

// never take ll as return type of find operation in strings
// never take d,x,y as variables........

int n,m,i,j;
char s[11];
vector<int> result;
int flag;
/*void dfs(int prev , int current , int steps)
{
    if(flag==1)
        return;

    if(steps == m)
    {
        flag=1;
        cout<<"YES\n";
        for(int i=0; i<result.size(); i++)
            cout<<result[i]<<" ";
        cout<<"\n";
        return ;
    }

        for(int i=current+1; i<=10; i++)
        {
            if(s[i]=='1' and prev!=i)
            {
                result.push_back(i);
                dfs(i, i-current, steps+1);
            }
        }

}
*/
void dfs(int prev,int cr,int k)
{
	int i;
	if(flag)return;
	if(k==m)
	{
		flag=1;
		cout<<"YES"<<endl;
		for(i=0;i<m;i++)cout<<result[i]<<" ";
		cout<<endl;
		return;
	}
	for(i=cr+1;i<=10;i++)
	 if(s[i]=='1' && prev!=i)
	 {
	 	result.push_back(i);
	 	dfs(i,i-cr,k+1);
	 }
}
int main()
{

    cin>>(s+1);
    cin>>m;
    dfs(0,0,0);

    if(flag==0)
        cout<<"NO\n";

       return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const ll MOD=1e9+7;
bool IsPowerOfTwo(ll x){ return (x != 0) && ((x & (x - 1)) == 0);}
ll poer(ll a,ll b){ll rs=1; while(b>0) { if(b&1) rs*=a; a*=a; b/=2;} return rs;}
ll mod_poer(ll a,ll b,ll mo){ll rs=1; while(b>0) { if(b&1) rs=(rs*a)%mo; a=(a*a)%mo; b/=2;} return rs%mo;}
ll d,x,y;
void ext_euclid(ll a,ll b){ if(b==0){d=a;x=1;y=0;}else{ext_euclid(b,a%b);ll temp=x;x=y;y=temp-(a/b)*y;}}
ll mod_inverse1(ll a,ll m){ext_euclid(a,m);return (x%m+m)%m;}
ll mod_inverse2(ll a,ll m){return mod_poer(a,m-2,m);}
ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}

// never take ll as return type of find operation in strings
// never take d,x,y as variables........

int n,m,i,j;
int main()
{
    string s;
    cin>>s;
    cin>>m;
    vector<int> wt;
    vector<int> result;

    for(i=0; i<s.length(); i++)
    {
        if(s[i]=='1')
            wt.push_back(i+1);
    }

    if(wt.size()==1 and m>1)
    {
        cout<<"NO\n";
        return 0;
    }
    else
    {
       ll xx=0,yy=0;
        int flag=0;
        int counter = 0;
        while(m>0)
        {
            if(flag==0)
            {

            xx += wt[counter];
            if(xx<=yy)
            {
                xx = xx- wt[counter];
                int temp = counter;
                counter = (counter+1)%wt.size();

                while(xx + wt[counter] <= yy and counter!=temp)
                  counter = (counter+1)%wt.size();

               if(counter == temp || xx + wt[counter]==yy)
                {
                 cout<<"NO\n";
                 return 0;
                }
                else
                    xx += wt[counter];

            }
            }
            else
            {

              yy += wt[counter];
            if(yy<=xx)
            {
                yy = yy- wt[counter];
                int temp = counter;
                counter = (counter+1)%wt.size();

                while(yy + wt[counter] <= xx and counter!=temp)
                  counter = (counter+1)%wt.size();

               if(counter == temp || yy + wt[counter]==xx )
                {
                 cout<<"NO\n";
                 return 0;
                }
                else
                    yy += wt[counter];
            }

            }

            result.push_back(wt[counter]);
            m--;
            counter = (counter+1)%wt.size();
            flag = (!flag);

        }

        cout<<"YES\n";

        for(i=0; i<result.size(); i++)
            cout<<result[i]<<" ";
        cout<<"\n";
    }
       return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const ll MOD=1e9+7;
bool IsPowerOfTwo(ll x){ return (x != 0) && ((x & (x - 1)) == 0);}
ll poer(ll a,ll b){ll rs=1; while(b>0) { if(b&1) rs*=a; a*=a; b/=2;} return rs;}
ll mod_poer(ll a,ll b,ll mo){ll rs=1; while(b>0) { if(b&1) rs=(rs*a)%mo; a=(a*a)%mo; b/=2;} return rs%mo;}
ll d,x,y;
void ext_euclid(ll a,ll b){ if(b==0){d=a;x=1;y=0;}else{ext_euclid(b,a%b);ll temp=x;x=y;y=temp-(a/b)*y;}}
ll mod_inverse1(ll a,ll m){ext_euclid(a,m);return (x%m+m)%m;}
ll mod_inverse2(ll a,ll m){return mod_poer(a,m-2,m);}
ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}

// never take ll as return type of find operation in strings
// never take d,x,y as variables........

int n,m,i,j;
char s[11];
vector<int> result;
int flag;
void dfs(int prev , int current , int steps)
{
    if(flag==1)
        return;

    if(steps == m)
    {
        flag=1;
        cout<<"YES\n";
        for(i=0; i<result.size(); i++)
            cout<<result[i]<<" ";
        cout<<"\n";
        return ;
    }
    else
    {
        for(i=current+1; i<=10; i++)
        {
            if(s[i]=='1' and prev!=i)
            {
                result.push_back(i);
                dfs(i, i-current, steps+1);
            }
        }
    }

}
int main()
{

    cin>>s+1;
    cin>>m;
    dfs(0,0,0);

    if(flag==0)
        cout<<"NO\n";

       return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define pf push_front
#define F first
#define S second
#define mp make_pair
#define sz(x) x.size()

using namespace std;

typedef long long llong;

const llong MXN = 3e5 + 7;
const llong MOD = 1e9 + 7;
const llong INF = 2e18 + 7;

inline void Need_for_speed()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

struct node
{
  int g, h, f;
};

llong m;
string s;
vector <int> ger;
vector <node> g[1001][11][11], path;
bool was[1001][11][11], used[1001][11][11], ok;
node start, p[1001][11][11];

void dfs(node v)
{
  //cout << v.g << ' ' << v.h << ' ' << v.f << endl;
  if(v.g == m){
    ok = 1;
    start = v;
  }
  for(node i : g[v.g][v.h][v.f]){
    p[i.g][i.h][i.f].g = v.g;
    p[i.g][i.h][i.f].h = v.h;
    p[i.g][i.h][i.f].f = v.f;
    dfs({i.g, i.h, i.f});
  }
}

int main()
{
  queue <node> q;
  cin >> s;
  for(int i = 0; i < sz(s); i++){
    if(s[i] == '1'){
      ger.pb(i + 1);
    }
  }
  cin >> m;
  q.push({0, 0, 0});
  //was[0][0][0] = 1;
  while(!q.empty()){
    node v;
    v = q.front();
    q.pop();
    if(v.g % 2 == 0){
      for(int i : ger){
        if(v.h != i && v.f + i > v.f && v.f + i <= 10 && v.f + i != 0){
          g[v.g][v.h][v.f].pb({v.g + 1, i, v.f + i});
          q.push({v.g + 1, i, v.f + i});
          //was[v.g + 1][i][v.f + i] = 1;
        }
      }
    }
    if(v.g % 2 != 0){
      for(int i : ger){
        if(v.h != i && v.f - i < v.f && v.f - i >= -10 && v.f - i != 0){
          g[v.g][v.h][v.f].pb({v.g + 1, i, v.f - i});
          q.push({v.g + 1, i, v.f - i});
          //was[v.g + 1][i][v.f - i] = 1;
        }
      }
    }
  }
  dfs({0, 0, 0});
  if(!ok){
    cout << "NO";
    return 0;
  }
  while(start.g != 0 || start.h != 0 || start.f != 0){
    path.pb({start.g, start.h, start.f});
    node now = start;
    start.g = p[now.g][now.h][now.f].g;
    start.h = p[now.g][now.h][now.f].h;
    start.f = p[now.g][now.h][now.f].f;
  }
  cout << "YES" << endl;
  for(node i : path){
    cout << i.h << ' ';
  }
  return 0;
}


#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long llong;

const llong MXN = 1e5 + 7;

int m, ans[10001], sum_1, sum_2;
string s;

int main()
{
  vector <int> v;
  cin >> s;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == '1') v.pb(i + 1);
  }
  cin >> m;
  if(v.empty()) {
    cout << "NO";
    return 0;
  }else
  if(v.size() >= 2){
    ans[1] = v[v.size() - 2], sum_1 += v[v.size() - 2];
  }else{
    ans[1] = v[v.size() - 1], sum_1 += v[v.size() - 1];
  }
  for(int i = 2; i <= m; i++){
    if(i % 2 == 0){
      for(int j : v){
        if(j != ans[i - 1] && sum_2 + j > sum_1){
          sum_2 += j;
          ans[i] = j;
          break;
        }
      }
    }else if(i % 2 != 0){
      for(int j : v){
        if(j != ans[i - 1] && sum_1 + j > sum_2){
          sum_1 += j;
          ans[i] = j;
          break;
        }
      }
    }
    if(!ans[i]){
      cout << "NO";
      return 0;
    }
  }
  cout << "YES" << endl;
  for(int i = 1; i <= m; i++){
    cout << ans[i] << ' ';
  }
  return 0;
}


#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long llong;

const llong MXN = 1e5 + 7;

int m, ans[10001], sum_1, sum_2;
string s;

int main()
{
  vector <int> v;
  cin >> s;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == '1') v.pb(i + 1);
  }
  cin >> m;
  for(int i = 1; i <= m; i++){
    if(i % 2 != 0){
      for(int j : v){
        if(sum_1 + j > sum_2 && ans[i - 1] != j){
          sum_1 += j;
          ans[i] = j;
          break;
        }
      }
    }
    if(i % 2 == 0){
      for(int j : v){
        if(sum_2 + j > sum_1 && ans[i - 1] != j){
          sum_2 += j;
          ans[i] = j;
          break;
        }
      }
    }
  }
  for(int i = 1; i <= m; i++){
    if(!ans[i]){
      cout << "NO";
      return 0;
    }
  }
  cout << "YES" << endl;
  for(int i = 1; i <= m; i++){
    cout << ans[i] << ' ';
  }
  return 0;
}


#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long llong;

const llong MXN = 1e5 + 7;

int m, ans[10001], sum_1, sum_2;
string s;

int main()
{
  vector <int> v;
  cin >> s;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == '1') v.pb(i + 1);
  }
  cin >> m;
  if(v.empty()){
    cout << "NO";
    return 0;
  }
  bool flag = false;
  for(int k = 0; k < v.size(); k++){
    sum_1 = 0, sum_2 = 0;
    bool ok = true;
    ans[1] = v[k], sum_1 += v[k];
    for(int i = 2; i <= m; i++){
      if(i % 2 == 0){
        for(int j : v){
          if(ans[i - 1] != j && sum_2 + j > sum_1){
            sum_2 += j;
            ans[i] = j;
            break;
          }
        }
      }else if(i % 2 != 0){
        for(int j : v){
          if(ans[i - 1] != j && sum_1 + j > sum_2){
            sum_1 += j;
            ans[i] = j;
            break;
          }
        }
      }
      if(!ans[i]){
        ok = false;
        break;
      }
    }
    if(ok){
      flag = ok;
      break;
    }
  }
  if(!flag){
    cout << "NO";
    return 0;
  }
  cout << "YES" << endl;
  for(int i = 1; i <= m; i++){
    cout << ans[i] << ' ';
  }
  return 0;
}