ll@N,@M,@A[N],@B[M];wt(sum[j,0,M](max(0,sum[i,0,N@A[i]==j+1](1)-B[j])));