require 'prime'

m, d = gets.chomp.split.map(&:to_i)
result = 0
month_yakusuu_juuika_ary = []

class Integer
  def my_divisor_list
    divisors = [1]
    primes = []
    Prime.prime_division(self).each do |prime|
      prime[1].times {primes << prime[0]}
    end

    1.upto(primes.size) do |i|
      primes.combination(i) do |prime|
        divisors << prime.inject{|a,b| a *= b}
      end
    end

    divisors.uniq!
    divisors.sort!
    return divisors
  rescue ZeroDivisionError
    return
  end
end

m.times do
  month_yakusuu_ary = m.my_divisor_list
  month_yakusuu_ary.delete(1)
  month_yakusuu_ary.delete_at(-1)

  month_yakusuu_ary.each do |ele|
    if ele < d then
      if ele < 10 then
        month_yakusuu_juuika_ary.push(ele)
      end
    end
  end

  month_yakusuu_juuika_ary.each do |ele|
    if month_yakusuu_juuika_ary.length != 1 then
      saisho = month_yakusuu_juuika_ary.first
      saigo = month_yakusuu_juuika_ary.last

      if saisho * 10 + saigo < d then
        result += 1
      end
      if saigo * 10 + saisho < d then
        result += 1
      end

      month_yakusuu_juuika_ary.shift
      month_yakusuu_juuika_ary.delete_at(-1)
    end

    if month_yakusuu_juuika_ary.length == 1 then
      if ele * 10 + ele < d then
        result += 1
      end
    end
  end

  month_yakusuu_juuika_ary = []
  m -= 1
end

p result
