well...I mean... isn't it obvious which season you should watch first?

toaru majutsu no index is the parent story to railgun, but I don't think you have to watch it in order to understan railgun. I've seen one episode of Railgun and it seems to do an OK job explaining everything