#include <iostream>
using namespace std;
int main()
{
int m, k;
cin >> m >> k;
int c = 0;
if (m % 19 != 0)
{
cout << "NO";
return 0;
}
while (m)
{
if (m % 10 == 3)
c++;
m /= 10;
}
if (c == k)
cout << "YES";
else
cout << "NO";
return 0;
}