Mark 2:15-17
15While Jesus was having dinner at Levi's house, many tax collectors and "sinners" were eating with him and his disciples, for there were many who followed him. 16When the teachers of the law who were Pharisees saw him eating with the "sinners" and tax collectors, they asked his disciples: "Why does he eat with tax collectors and 'sinners'?"
17On hearing this, Jesus said to them, "It is not the healthy who need a doctor, but the sick. I have not come to call the righteous, but sinners
If we will take the verse within it's context we will see that Jesus was referring to the Pharisees. Look at verse 17, "On hearing this............."
"this" is pointing to the comments that the pharisees made,
then after Jesus heard the comments he gave his reply to the people around him and his reply was
"it is not the healthy who need a doctor, but the sick. I have not come to call the righteous, but sinners"
therefore the righteous was referring to the pharisees. The pharisees are acting and thinking that they are righteous and Jesus was telling us what the pharisees are doing.