Chef and Powers

All submissions for this problem are available.
Chef has 2 integers, $n$ and $k$. He has an array $A$ of size $n$. He wants to find the number of integers from 1 to $k$(including 1 and $k$) which are perfect $A_i$th power for every $i$, $1 \leq i \leq n$. A perfect $x$th power is a number of the form $m^x$, where $m \geq 1$ is a positive integer. For example, if $x$=4, then $y$=1,16,81 etc. are perfect 4th power numbers. Can you help Chef in finding out the answer? ###Input:  The first line contains 2 spaceseparated integers, $n$ and $k$.  Next line contains $n$ spaceseparated integers $A_1,A_2,...,A_n$. ###Output: Output one integer the number of integers from 1 to $k$ which are perfect $A_i$th power for every $i$ from 1 to $n$. ###Constraints  $1 \leq n \leq 10^5$  $1 \leq k \leq 10^{18}$  $2 \leq A_i \leq 10^9$ ###Subtasks  Subtask #1(100 points) : Original Constraints ###Sample Input: 2 100 2 3 ###Sample Output: 2 ###EXPLANATION: The integers from 1 to 100 which are both perfect squares and perfect cubes are 1 and 64.Author:  pratims10 
Tags  pratims10 
Date Added:  23122019 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 