We study the superconformal indices of 4d theories coming from 6d N = (2, 0) theory of type F on a Riemann surface, with the action of the outer-automorphism a in the trace. We find that the indices are given by the partition function of a deformed 2d Yang-Mills on the Riemann surface with gauge group G which is S-dual to the subgroup of F fixed by sigma. In the 2-parameter deformed version, we find that it is governed not by Macdonald polynomials of type G, but by Macdonald polynomials associated to twisted affine root systems.