O(m)