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

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int &it : a) {
        cin >> it;
        it %= 200;
    }
    vector<int> p(200, -1);
    if (n > 8) n = 8;
    for (int m = 1; m < (1 << n); m++) {
        int sum = 0;
        for (int i = 0; i < n; i++) {
            if ((m >> i) % 2 == 1) {
                sum += a[i];
            }
        }
        sum %= 200;
        if (p[sum] != -1) {
            cout << "Yes\n";
            cout << __builtin_popcount(p[sum]);
            for (int i = 0; i < n; i++) {
                if ((p[sum] >> i) % 2 == 1) {
                    cout << ' ' << i + 1;
                }
            }
            cout << '\n';
            cout << __builtin_popcount(m);
            for (int i = 0; i < n; i++) {
                if ((m >> i) % 2 == 1) {
                    cout << ' ' << i + 1;
                }
            }
            cout << '\n';
            return 0;
        } else {
            p[sum] = m;
        }
    }
    cout << "No\n";
}

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

const int N = 200010, mod = 1e9 + 7;

ll dp[N][20], k, num[N];
char s[N];

ll dfs(int pos, bool limit, bool lead, int cnt, ll state, int now){
	if(!pos){
		//printf("now = %d cnt = %d state = %lld\n", now, cnt, state);
		return cnt == k;
	}	
	if(cnt > k)	return 0;
	if(!limit && !lead && ~dp[pos][cnt])	return dp[pos][cnt];
	ll ans = 0;
	int up = limit ? num[pos] : 15;
	//printf("up = %d\n", up);
	for(int i = 0; i <= up; ++ i){
		if(lead && !i)	ans = (ans + dfs(pos - 1, limit && i == up, true, 0, 0, 0)) % mod;
		else{
			//printf("pos = %d i = %d a = %d st = %d st | a = %d\n", pos, i, 1 << i, state, state | (1 << i));
			//printf("State = %lld x = %d\n", state, state || (1 << i));
			if((state >> i) & 1)	ans = (ans + dfs(pos - 1, limit && i == up, false, cnt, state, now * 16 + i)) % mod;
			else	ans = (ans + dfs(pos - 1, limit && i == up, false, cnt + 1, state | (1 << i), now * 16 + i)) % mod;
		}
	}
	if(!limit && !lead)	dp[pos][cnt] = ans;
	return ans;
}

ll solve(){
	int len = strlen(s + 1);
	for(int i = 1, j = len; i < j; ++ i, -- j)	swap(s[i], s[j]);
	for(int i = 1; i <= len; ++ i){
		if(s[i] >= '0' && s[i] <= '9')	num[i] = s[i] - '0';
		else	num[i] = s[i] - 'A' + 10;
	}
//	for(int i = 1; i <= len; ++ i)	printf("%d ", num[i]);
//	exit(0);
	return dfs(len, true, true, 0, 0, 0);
} 

int main(){
	scanf("%s", s + 1);
	cin >> k;
	memset(dp, -1, sizeof dp);
	cout << solve();
	return 0;
}