Updated logic of initializing ArrayMap that chooses a much smaller value that can still hold everything.