Rasta and Tavas

2.7

46 votes
Brute-force search, Open, Easy, Mathamatics
Problem

See Russian translation

Rasta calls a number like a Tavas if and only if 1 ≤ a ≤ n and the sum of all primes (like p) that p | a is exactly equal to k.

He asks you to find the number of Tavases.

Input format

The first and only line of input contains two integers, n and k (1 ≤ n, k ≤ 106).

Output format

Print a single integer, the number of Tavases.

Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

The only Tavases are 7, 10 and 20.

Editor Image

?