It is well-known that the equation: xk+yk=zk has no positive solution for k≥3. But what if we consider solution over a finite field. Now, the task you are given is related to that:
Given a prime P, you are asked to count the number of positive integers k doesn't exceed L s.t. modulo equation xk+yk=zk (modulo P) has solution 0<x,y,z<P.
Input Format
A line contains two space-separated integers P,L as described above.
Output Format
Output answer in a single line.
Constraints
Let's enumerate all possible values of k:
So, answer is 2.