#include<bits/stdc++.h> using namespace std; int main(){ int m,k,s=0,n; cin>>m>>k; n=m; while(m!=0){ if(m%10==3){ s++; } m/=10; } if(s==k && n%19==0) cout<<"YES"; else cout<<"NO"; return 0; }