arithmetic sequence problem

sry it's me with another question again. my test is coming up and my teacher is giving us all these challenge problems to prepare.

The sum of the first n terms in a certian arithmetic sequence is given by Sn = 3n^2 - n. Show that the nth term of the sequence is given by an = 6n - 4.

so i have this so far:

S_n = (n/2)(a1 + a_n) = 3n^2 - n

i then solved for (a1 + a_n) = 6n - 2

i also have the equation a_n = a1 + d(n-1)

i have tried solving for a_n, a1, and d using these equations but i'm not getting anywhere. Please help me.