Joseph and Array
Practice
4.1 (64 votes)
Combinatorics
Easy
Math
Number theory
Problem
86% Success 5979 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Joseph loves questions with arrays! His friend Nick gave him interesting problem!

Initially, there is an array with n positive integers, numbered 1 through n. Let quality be a multiplication of all integers from the array. More formally, quality = a1 * a2 * a3 * ... * an. Nick is interested in number of arrays with size of k with same quality.

Of course, Joseph found that this problem is really hard for him. So, he needs your help.

Input format

The first line contains a single integer n and k — the number of positive integers in the array and the size of the arrays you have to count, respectively.

The next line contains n integers a1, a2, ..., an — an array which was described above.

Output format

Print the answer modulo 109 + 7.

Note: The numbers in all k-sized arrays must be positive.

Constraints

  • 1 <= n, k <= 105
  • 1 <= ai <= 106

Subtasks

  • Subtask #1 (10 points) : n, k <=10 and the quality <= 10
  • Subtask #2 (90 points) : Original constraints

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
52 votes
Tags:
Basic ProgrammingNumber theoryBasic Number Theory-1MathNumber Theory
Points:30
57 votes
Tags:
ApprovedCombinatoricsEasyException handlingMathNumber TheoryOpenProbabilityStatistics
Points:30
262 votes
Tags:
ApprovedEasyMathNumber TheoryReady