求该数组对比的简化代码,感谢各位热心人!该怎么处理

求该数组对比的简化代码,感谢各位热心人!
假设:
VB code

    Dim a() As Byte, b() As Byte
    ReDim a(2)
    a(0) = 2: a(1) = 1: a(2) = 1
    ……这里通过某些操作使得 b 也拥有了3个有效元素,但内容随机



我要实现的效果是:

如果 b 为:2,1,1 则什么都不做
如果 b 为:x,2,1 则 ReDim b 为 x,2,1,1
如果 b 为:x,y,2 则 ReDim b 为 x,y,2,1,1
如果 b 为:x,y,z 则 ReDim b 为 x,y,z,2,1,1

简单描述就是要确保 b 里面最后3个元素是2,1,1。允许扩充 b,但不允许最后重复出现2,1,1。即:2,1,1,2,1,1 是不允许的。

问题完毕!

对回答前辈们的要求:
1、其中的 2,1,1 只是本例中的假设数组尾部,请勿针对 1,2 的数字做文章!
2、请以最少变量、最简短的代码实现,复杂的方式则没必要回复了!

再次感谢!!!

------解决方案--------------------
再改下:

VB code

Sub GetBytes(souByte() As Byte, conByte() As Byte)
    
    Dim LenSouByte As Long, LenConByte As Long
    Dim i As Long, j As Long
    Dim Length As Long
    
    LenSouByte = UBound(souByte)
    LenConByte = UBound(conByte)
    
    For i = LenSouByte - LenConByte To LenSouByte
        j = i
        Length = 0
        Do While (souByte(j) = conByte(Length))
            j = j + 1
            Length = Length + 1
            If j > LenSouByte Then Exit For
        Loop
    Next i
    ReDim Preserve souByte(LenSouByte + (LenConByte + 1 - Length))
    j = LenConByte
    For i = UBound(souByte) To LenSouByte + 1 Step -1
        souByte(i) = conByte(j)
        j = j - 1
    Next
End Sub