@SuppressWarnings("unchecked")
	public static <E> List<E> firstK(List<E>list,int k){
		Queue<E>pq=new PriorityQueue<>(k,Collections.reverseOrder());
		for(E e:list)
			if (pq.size()<k) pq.offer(e);
			else if (((Comparable<?super E>)pq.peek()).compareTo(e)>0){pq.poll();pq.offer(e);}
		return new ArrayList<>(pq);
	}