Texas guts out win over Kansas St.