Can someone explain what the ReDim and UBound are doin in the below code in very basic terms?

Dim X, Y(), i&, j&, k&, NR&
X = Sheets("Sheet1").Range("A3").CurrentRegion.Value
ReDim Y(1 To UBound(X, 1) * UBound(X, 2), 1 To 3)
For i = 2 To UBound(X, 1)
    For j = 2 To UBound(X, 2)