#include <bits/stdc++.h>
using namespace std;
const int nmax = 1e6;
int v[nmax+2];
signed main()
{
    int n , k ;
    cin >> n >> k ;
    for ( int i = 1 ; i <= n ; ++ i ) cin >> v[i];
    int nr = 0 ;
    for ( int i = 1;  i <= n ; ++ i )if ( v[i] == 1 ) ++ nr ;
    if ( nr >= k ) cout << 1 ;
    else cout << 2;
    return 0;
}
