n, m = map(int, input().split()) def count_p_in_factorial(n, p): count = 0 while n > 0: n = n // p count += n return count count_2 = count_p_in_factorial(n, 2) count_5 = count_p_in_factorial(n, 5) m_count_2 = 0 temp = m while temp % 2 == 0 and temp != 0: m_count_2 += 1 temp = temp // 2 m_count_5 = 0 temp = m while temp % 5 == 0 and temp != 0: m_count_5 += 1 temp = temp // 5 total_2 = count_2 + m_count_2 total_5 = count_5 + m_count_5 print(min(total_2, total_5))