#include <bits/stdc++.h>   using namespace std;   long long k, l;   int main() {     cin >> k >> l;     long long K = k;     int res = 0;     while (K < l) {       K *= k;       res++;     }     if (K == l) {       cout <<  YES  << endl;       cout << res << endl;     } else {       cout <<  NO  << endl;     }     return 0;   }   