#include <bits/stdc++.h>
using namespace std;
int main() {
  double k, l, temp;
  int count = 0;
  scanf("%lf", &k);
  scanf("%lf", &l);
  temp = k;
  while (1) {
    if (temp > l) {
      printf("NO\n");
      break;
    } else if (temp < l) {
      temp = temp * k;
      count++;
    } else {
      printf("YES\n");
      printf("%d", count);
      break;
    }
  }
  return 0;
}
