{ll@n,@h,x=1;rep(n){ll@a;x=x*a%h;}wt(x?"NO":"YES");}