changed <k to <=k