JavaScript Solution
```\nvar smallestRepunitDivByK = function(K) {\n    let count = 1\n    let start = 1\n    let set = new Set()\n    while (start) {\n        let r = start % K\n 
```\nvar smallestRepunitDivByK = function(K) {\n    let count = 1\n    let start = 1\n    let set = new Set()\n    while (start) {\n        let r = start % K\n        if ( r === 0 ) {\n            break\n        }\n        if ( set.has(r) === true ) {\n            return -1\n        } else {\n            set.add(r)\n            start = r * 10 + 1\n            count++\n        }\n        \n    }\n    return count\n};
['JavaScript']