#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define bit(n,k) ((n>>k)&1) //nのk　bit目
#define vec(T) vector<T>
#define vvec(T) vector<vector<T>>
using ll = long long;
using P = pair<int,int>;
using Pll = pair<ll,ll>;


template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll llINF = 1LL << 60;
const int iINF = 1e9;

//------------------------------------------------


struct Solver{

    ll M;
    vec(ll) S;


    bool f(ll n){
        bool res=true;
        ll mm=M;
        ll ten=1;

        for(int i=S.size()-1; i>=0 ; i--){
            mm -= S[i]*ten;
            if(mm<0) res = false;
            if(i>0 && M/n<ten) res=false;
            else ten*=n;
            if(!res) break;
        }
        return res;
    }


    ll bs(ll l, ll r){
        //cout << l << " " << r << endl;
        ll res;
        if(r-l==1) return l;
        ll n = (r+l)/2;
        if(f(n)) res=bs(n,r);
        else res=bs(l,n);
        return res;
    }




    void solve(){
        string X;
        cin >> X;
        cin >> M;

        int l = X.length();
        rep(i,l) S.push_back(X[i]-48);
        ll d=0;
        rep(i,l) chmax(d,S[i]);
        
        if(l==1){
            if(S[0]>M) cout << 0 << endl;
            else cout << 1 << endl;
            return;
        }
    
        ll ans;
        ans = bs(d,M+100) - d;
        cout << ans << endl;


        /*
        ll n = d+1;
        ll ans;
        while(){
            vec(ll) mv;
            ll mm = M;
            while(mm){
                mv.push_back(mm%n);
                mm/=n;                
            }
            if( mv.size()>l ){
                n++;
            }else if( mv.size() < l){
                ans = n-d-1;
            }else{
                bool f=true;
                rep(i,l) if(mv[i]<)

            }

        }
        */


        /*

        if(l==1){
            if(S[0]>M) cout << 0 << endl;
            else cout << 1 << endl;
            return;
        }

        double ex = M / double(S[0]);
        ll nn = floor( pow(ex,1/double(l-1)));
        cout << nn-d-1 << endl;
        
        */



        /*
        ll nn =d+1;
        //ll nn=1;
        //ll ex = log10(M)/(l-1);
        //rep(i,ex) nn*=10;

        while(1){
            ll mm=M;
            ll ten=1;
            cout << "nn=" << nn << endl;
            for(int i=l-1; (i>=0 && mm>=0); i--){
                mm -= S[i]*ten;
                ten *=nn;
            }
            if(mm<0){
                cout << max(ll(0),nn-d-1) << endl;
                break;
            }
            nn++;
        }
        */

    }
};


int main(){
    int testcasenum=1;
    //cin >> testcasenum;
    rep1(ti,testcasenum){
        Solver solver;
        solver.solve();
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define Rep(i,j,n) for (ll i=(ll)(j);i<=(ll)(n);++i)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const int mod = 998244353;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

/*
ll ti=clock();
cout<<("Execution Time: %.4lf sec", 1.0 * (clock() - ti) / CLOCKS_PER_SEC)<<endl;
*/

int main(){
  ll n;
  cin>>n;
  vll rest(200,vl(0));//1-indexの番号保管
  vl a(n);
  ll x,y;
  rep(i,n){
      cin>>a[i];
      a[i]%=200;
      if(sz(rest[a[i]])==0){
          rest[a[i]].pb(i+1);
      }
      else{
          print("Yes");
          x=1;
          y=1;
          cout<<x<<" "<<rest[a[i]][0]<<endl;
          cout<<y<<" "<<i+1<<endl;
          return 0;
      }
  }

  Rep(i,1,199){
      if(sz(rest[i])!=1){
          continue;
      }
      Rep(j,1,i-1){
          if(sz(rest[j])>0){
              if(sz(rest[(i+j)%200])>0){
                  vl ans_x,ans_y;
                  print("Yes");
                  for(ll X:rest[(i+j)%200]){
                      ans_x.pb(X);
                  }
                  for(ll Y:rest[i]){
                      ans_y.pb(Y);
                  }
                  for(ll Y:rest[j]){
                      ans_y.pb(Y);
                  }
                  sort(all(ans_x));
                  sort(all(ans_y));
                  cout<<sz(rest[(i+j)%200])<<" ";
                  for(ll X:ans_x){
                      cout<<X<<" ";
                  }
                  cout<<endl;
                  cout<<sz(rest[i])+sz(rest[j])<<" ";
                  for(ll Y:ans_y){
                      cout<<Y<<" ";
                  }
                  return 0;
              }
              else{
                  for(ll k:rest[i]){
                    rest[(i+j)%200].pb(k);
                  }
                  for(ll k:rest[j]){
                    rest[(i+j)%200].pb(k);
                  }
              }
          }
      }
  }
  print("No");
}