Chef and Way

All submissions for this problem are available.
Read problems statements in Russian also.
After visiting a childhood friend, Chef wants to get back to his home. Friend lives at the first street, and Chef himself lives at the Nth (and the last) street. Their city is a bit special: you can move from the Xth street to the Yth street if and only if 1 <= Y  X <= K, where K is the integer value that is given to you. Chef wants to get to home in such a way that the product of all the visited streets' special numbers is minimal (including the first and the Nth street). Please, help him to find such a product.
Input
The first line of input consists of two integer numbers  N and K  the number of streets and the value of K respectively. The second line consist of N numbers  A_{1}, A_{2}, ..., A_{N} respectively, where A_{i} equals to the special number of the ith street.
Output
Please output the value of the minimal possible product, modulo 1000000007.
Constraints
 1 ≤ N ≤ 10^5
 1 ≤ A_{i} ≤ 10^5
 1 ≤ K ≤ N
Example
Input: 4 2 1 2 3 4. Output: 8
Scoring
Subtask 1 (30 points): N <= 80
Subtask 2 (70 points): See the constraints.
Author:  furko 
Tester:  xcwgf666 
Editorial  http://discuss.codechef.com/problems/CHRL4 
Tags  dp easymedium furko ltime08 
Date Added:  21012014 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 4.9.2, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.4, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC 
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. 
dp[i]=min(dp[i],(dp[j]*a[i])%
whts wrong with this int
it is my first time in this
run time error:(
I think answer for
I think their is a problem ..
run time error :(
It would be nice that rather
We need for more test cases
how can check test case input
can anyone explain me this
Please ...also give
somebody help me.what is
I can't understand the
smj ni aya qustion explain it
yo very ajibbbbbbbb qustion
vikas its so simple why dont
solution bej phir aur pehle
what is the meaning of ..
@ arpitmittal555 The numbers
how the output for the given
how the output for the given
Wrong answer, I have tried a
can someone explain the
i understand the
can i assume that the street
its giving right answer in my
could you explain this
In the input I could see a
The problem should definitely
are A1, A2...An consecutive
Can somebody please tell me
how the output for the given
@s_khansari That's confusing
@coolrohan123 i hope it means
May someone please explain
@s_khansari read the question
thanks
this site is incomplete, as
everything is working fine
Is the special number given
where to write the code????
what's wrong with my
@aamirsuhail01 your for loop