What is wrong with my code?

And also please if you can then please give some clarity on question ?

Here is a question link CodeChef: Practical coding for everyone

```
using namespace std;
#define ll long long int
int main() {
ll n,k;
cin>>n>>k;
ll a[n];
ll x[n];
for(ll i=0;i<n;i++)
{
cin>>a[i];
x[i]=i;
}
ll ind,val;
ind=n-1;
val=a[n-1];
for(ll i=n-2;i>=0;i--)
{
if(a[i]>val)
{
x[i]=ind;
}
else
{
if(a[i]<=val)
{
val=a[i];
ind=i;
}
}
}
ll ans=1;
for(ll i=0;i<n;i++)
{
// cout<<x[i]<<" ";
ans = ans*(x[i]-i+1);
ans = ans % 1000000007;
}
// cout<<endl;
cout<<ans<<endl;
return 0;
}
```