calculating K from data 5