This page is still under construction.

Parts of this page are still being built. What you see may change.

Dirichlet kk-th root

Time limit1sMemory limit256 MB

Summary
Given g on 1..n over F_p with g(1)=1, find f with f(1)=1 such that the k-fold Dirichlet convolution of f equals g, or report no solution.
Level

Hard9 of 10

Topics
Number theory, Math, Divide and conquer, Implementation
Solved
No attempts yet

Problem

Mathematician Pang learned Dirichlet convolution during the previous camp. However, compared with deep reinforcement learning, it was too easy for him. Therefore, he did something special.

If f,g:{1,2,…,n}→Zf,g: \{1,2,\ldots,n\} \to \mathbb {Z} are two functions from the positive integers to the integers, the Dirichlet convolution f\*gf \* g is a new function defined by: (f\*g)(n)=∑_d∣nf(d)g(nd).(f \* g)(n) =\sum\_{d \mid n}f(d)g ({\frac {n}{d}}) .

We define the kk-th power of a function g=fkg=f^k by fk=f\*…\*f⏟_ktimes. f^{k}=\underbrace {f \* \dots \* f} \_{k {\textrm {times}}}.

In this problem, we want to solve the inverse problem: given gg and kk, you need to find a function ff such that g=fkg=f^k.

Moreover, there is an additional constraint that f(1)f(1) and g(1)g(1) must equal 11. And all the arithmetic operations are done on F_p\mathbb{F}\_{p} where p=998244353p=998244353, which means that in the Dirichlet convolution, (f\*g)(n)=(∑_d∣nf(d)g(nd)) mod p(f \* g)(n) =\left(\sum\_{d \mid n}f(d)g ({\frac {n}{d}})\right) \bmod p.

Input

The first line contains two integers nn and k(2≤n≤105,1≤k<998244353)k (2\leq n\leq 10^5,1\leq k<998244353) .

The second line contains n integers g(1),g(2),...,g(n)g(1), g(2),..., g(n) (0≤g(i)<998244353,g(1)=10\le g(i)<998244353, g(1)=1).

Output

If there is no solution, output −1-1.

Otherwise, output f(1),f(2),...,f(n)f(1), f(2), ..., f(n) (0≤f(i)<998244353,f(1)=10\le f(i)<998244353, f(1)=1). If there are multiple solutions, print any of them.

Examples1

  1. Example 1

    Input
    5 2
    1 8 4 26 6
    
    Expected output
    1 4 2 5 3