Graphene and MoS2 interacting with water: A comparison by ab initio calculations