#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    int n,k; cin >> n >> k;
    int cnt1 = 0;
    for(int i = 0; i < n; i++) {
        int x; cin >> x; cnt1 += (x==1);
    }
    cout << (k > cnt1 ? 0 : 1) << endl;
}