#!/bin/bash read N K seq 2 $N | factor | awk -v K=$K 'BEGIN{sum=0} {c=0; pre=0;for(i=2;i<=NF;i++){if(pre==$i)continue;c+=1;pre=$i};if(c>=K)sum+=1}END{print sum}'