Output all numbers below certain number containing certain digits Output all numbers in certain range containing certain digits

Task


Take an input of digits through console, prompt, or a file (in the decimal number system). These digits should be separated by spaces.
Take an input of the "maximum" through console, prompt, or a file
If you use a file, the program must output "[Data taken from file]"
Print all natural numbers (including 0) below the maximum containing at least one of the digits specified by the user (they may contain other digits), separated by a single space. Leading 0s do not count!
If there is a sequence of 10 or more consecutive numbers, it should output the first and last, separated by a --&gt;


Rules


Standard loopholes are (obviously) not allowed
Programs must complete the tasks above
The answer with the fewest characters wins


Examples

&gt;&gt;&gt; 1 3
&gt;&gt;&gt; 100
1 3 10 --&gt; 19 21 23 30 --&gt; 39 41 43 51 53 61 63 71 73 81 83 91 93




&gt;&gt;&gt; 1 2 4 5 6 7
&gt;&gt;&gt; 29
1 2 4 5 6 7 10 --&gt; 28




&gt;&gt;&gt; 0 1 2 3 4 5 6 7 8 9
&gt;&gt;&gt; 9999999
0 --&gt; 9999998




[Data taken from file]
1 3 5 7 9
Ruby, 186 181 177 bytes

a=gets.split;puts ([0]+(0...gets.to_i).select{|x|(x.to_s.split('')&amp;a).any?}).each_cons(2).slice_before{|m,n|m+1&lt;n}.map{|a|c=a.map &amp;:last;c.count&gt;9?[c[0],'--&gt;',c.last]:c}.join' '


Ungolfed explanation:

# Read numbers from input and split into array
a = gets.split

# Loop from 0 to maximum number, exclusive
puts ([0]+(0...gets.to_i).select { |x| 
  # Only include numbers that include at least one input digit
  (x.to_s.split('')&amp;a).any?
})    # Add dummy element to the beginning of array
.each_cons(2)   # Get each array of 2 consecutive elements
.slice_before { |m, n| #
  m + 1 &lt; n # "Slice" the array if m and n are not consecutive
}.map { |a|
  c = a.map &amp;:last # Get all the last elements in `a`
  if c.count &gt; 9
    # 10 or more consecutive elements. Get the first and last, and
    # an arrow in-between
    [c[0],'--&gt;',c.last]
  else
    c
  end
}.join ' ' # Add space in-between all elements, and print result