#include <bits/stdc++.h>
using namespace std;
int m, k, a, b, c, d, e, s1, s2;
int main() {
cin >> m >> k;
a = m % 10;
b = m / 10 % 10;
c = m / 100 % 10;
d = m / 1000 % 10;
e = m / 10000;
if (m % 19 == 0)
s1 = 1;
if (a == 3)
s2++;
if (b == 3)
s2++;
if (c == 3)
s2++;
if (d == 3)
s2++;
if (e == 3)
s2++;
if (s1 == 1 && s2 == k)
cout << "YES";
else
cout << "NO";
return 0;
}