Filter Duplicate Elements in Haskell
If you write uniq as a right fold, you don't need to pass an accumulator through, and the list comes out in the right order:

uniq :: Eq a =&gt; [a] -&gt; [a]
uniq [] = []
uniq (x:xs) = (if x `elem` xs then id else (x:)) $ uniq xs

filt :: Show a =&gt; Num a =&gt; Read a =&gt; Eq a =&gt; Integral b =&gt; [a] -&gt; b -&gt; [a]
filt k is = uniq [i | i &lt;- is, count i is &gt;= k]


(Edit: Actually that one throws out the first of each two equal elements, not the last. Here`s one without that problem:

uniq :: Eq a =&gt; [a] -&gt; [a]
uniq [] = []
uniq (x:xs) = x : uniq (filter (/=x) xs)


)

You've commendably already brought count into a form that allows it to be written in terms of library combinators:

count :: Eq a =&gt; Integral b =&gt; a -&gt; [a] -&gt; b
count e = sum . map (\a -&gt; if a == e then 1 else 0)


That's a bit ugly due to lambdas though, here's a nicer version:

count e = length . filter (== e)


For separation of monadic and pure code (and generally for factoring out common code from across cases), here's a showList to replace printList:

showList :: Show a =&gt; [a] -&gt; String
showList [] = "-1"
showList a = unwords [show i | i &lt;- a] 


Calling a monadic action a given number of times doesn't need manual recursion, and thus also doesn't need to give the repeated action a name:

main :: IO () 
main = do
  a &lt;- readLn
  replicateM_ a $ do
    [_n, k] &lt;- map read . words &lt;$&gt; getLine
    numbers &lt;- map read . words &lt;$&gt; getLine
    putStrLn $ showList $ filt k numbers


(I think readNumbers doesn't deserve a name.)

In case the order in which the output is given isn't important, here's a version that doesn't require quadratic time because each element is compared to every other:

filt k = map head . filter ((&gt;=k) . length) . group . sort


which relies on Data.Lists sort being faster than quadratic time.