#define _GLIBCXX_DEBUG #include #include #include using namespace atcoder; using namespace std; typedef long long ll; #define rep(i,a,b) for(int i=a;i; using vvi = vector; using li =vector; using lli=vector
  • ; using si =vector; using ssi =vector; const long long INF = 1e18; const long long MOD=1e9+7; //for (auto [key, val] : mp) int main() { ll n,k;cin>>n>>k; li vec(n); rep(i,0,n)cin>>vec[i]; ll a=0,b=n-1; rep(i,0,k-1){if(vec[i]==1){a=i;}if(vec[i]==0){a=i+1;}} rep(i,k,n){if(vec[i]==1){b=i;break;}else if(vec[i]==0){b=i-1;break;}} if(vec[k-1]>1){ ll ans=0; rep(i,a,b+1)ans+=vec[i]; cout<