#include <bits/stdc++.h>

using namespace std;

typedef int64_t ll;

void solve () {
    ll n, k; cin >> n >> k;

    vector<ll> v(n);
    for (ll& x : v) cin >> x;

    ll cnt_ones = count(v.begin(), v.end(), 1);

    if (cnt_ones >= k) {
        cout << 1 << endl; return;
    }

    cout << 0 << endl;
}

signed main () {
    ll t = 1; //cin >> t;

    for (ll cs = 1; cs <= t; ++cs) {
        // cout << "Case " << cs << ": " << endl;
        solve ();
    }
}   