The Maxima package has a function RATWEIGHT that can be used to assign weights to variables:
Function: RATWEIGHT (v1, w1, ..., vn, wn)assigns a weight of wi to the variable vi. This causes a term to be replaced by 0 if its weight exceeds the value of the variable RATWTLVL [default is FALSE which means no truncation]. The weight of a term is the sum of the products of the weight of a variable in the term times its power. Thus the weight of 3*v1**2*v2 is 2*w1+w2. This truncation occurs only when multiplying or exponentiating CRE forms of expressions.
(D5) [[B, 1], [A, 1]]
(D7)/R/ B + (2 A + 2) B + A + 2 A + 1
(D9)/R/ 2 B + 2 A + 1
I am wondering whether there is an alternative for this in Maple...