Almost Prime number

Problem:A no is said to be  k-Almost Prime Number if it  has exactly k prime factors (not necessary distinct). Your task is to complete the functionprintKAlmostPrimes which takes two argument k and N and prints the  first N numbers that are k prime. Problem Link

 

11466

There should be a better approach to improve the time complexity.

 

1644

 

12542

 

10780

 

10394

 

11347

 

11415

 

10856

 

10139