L,N,*W=$<.read.split.map &:to_i s=0 W.sort.each.with_index do |e,i| if L