When Petya went to school, he got interested in large numbers and what they were called in ancient times. For instance, he learned that the Russian word "tma" (which now means "too much to be counted") used to stand for a thousand and "tma tmyschaya" (which literally means "the tma of tmas") used to stand for a million.

Petya wanted to modernize the words we use for numbers and invented a word petricium that represents number *k*. Moreover, petricium la petricium stands for number *k*<sup class="upper-index">2</sup>, petricium la petricium la petricium stands for *k*<sup class="upper-index">3</sup> and so on. All numbers of this form are called petriciumus cifera, and the number's importance is the number of articles la in its title.

Petya's invention brought on a challenge that needed to be solved quickly: does some number *l* belong to the set petriciumus cifera? As Petya is a very busy schoolboy he needs to automate the process, he asked you to solve it.
The first input line contains integer number *k*, the second line contains integer number *l* (2 ≤ *k*, *l* ≤ 2<sup class="upper-index">31</sup> - 1).
5
25
YES
1
3
8
NO
123
123
YES
0
99
970300
NO
1000
6666666
NO
59
3571
NO
256
16777217
NO
4638
21511044
YES
1
24
191102976
YES
5
52010
557556453
NO
61703211
1750753082
NO
137
2571353
YES
2
8758
1746157336
NO
2
64
YES
5
96
884736
YES
2
1094841453
1656354409
NO
1154413
1229512809
NO
2442144
505226241
NO
11548057
1033418098
NO
581
196122941
YES
2
146
1913781536
NO
945916
1403881488
NO
68269
365689065
NO
30
900
YES
1
6
1296
YES
3
1470193122
1420950405
NO
90750
1793111557
NO
1950054
1664545956
NO
6767692
123762320
NO
1437134
1622348229
NO
444103
1806462642
NO
2592
6718464
YES
1
50141
366636234
NO
835
582182875
YES
2
156604
902492689
NO
27385965
1742270058
NO
3
9
YES
1
35
1838265625
YES
5
8
4096
YES
3
85955
945811082
NO
54958832
956670209
NO
1475381
1348159738
NO
7313241
413670642
NO
582470
2116368165
NO
26859739
595086170
NO
249766393
1582130
NO
11734
137686756
YES
1
925093
1098566745
NO
40
1600
YES
1
2147483647
2147483647
YES
0
2147483646
2147483647
NO
2147483647
2147483646
NO
2
2147483647
NO
2
1073741825
NO
2
1073741824
YES
29
10000
10
NO
10
10000
YES
3
10
2000000000
NO
10
1000000000
YES
8
5
1808548329
NO
2
2147483646
NO
25
125
NO
6
18
NO
5
30
NO
n=int(input())
m=int(input())
if m%n!=0:
	print("NO")
else:
	p,x=0,0
	while p<m:
		p=n**x
		if p==m:
			print("YES")
			print(max(x-1,0))
			break
		x+=1
	else:
		print('NO')