n, m, h = map(int, input().split())
a = list(map(int, input().split()))
ans = 1
S = sum(a)
if S < n:
print(-1)
else:
if S-a[h-1] < n-1:
print(1)
else:
up = S-a[h-1]
down = S-1
for i in range(1, n):
ans = ans*(up/down)
up -= 1
down -= 1
print(1-ans)
// Problem: B. Basketball Team
// Contest: Codeforces - Codeforces Beta Round #83 (Div. 1 Only)
// URL: https://codeforces.com/problemset/problem/107/B
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
using namespace std;
void solve() {
// READ QUESTION AGAIN 5 MINS AFTER YOU HAVE READ ONCE
int N, M, H;
cin >> N >> M >> H;
int sum = 0;
int curr = 0;
for (int x = 0; x < M; x++) {
int nb;
cin >> nb;
sum += nb;
if (x == H - 1) curr = nb;
}
/*
3 2 1
2 2
*/
if (sum < N) {
cout << -1 << '\n';
return;
}
if (sum - curr <= N - 2) {
cout << 1 << '\n';
return;
}
long double neg = 1;
for (int x = 0; x + 1 < curr; x++) {
neg *= (sum - N - x) / (long double)(sum - x - 1);
}
cout << fixed << setprecision(10) << 1 - neg << '\n';
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int T = 1;
// cin >> T;
while (T--) {
solve();
}
return 0;
}
550C - Divisibility by Eight | 5A - Chat Servers Outgoing Traffic |
615A - Bulbs | 5B - Center Alignment |
549A - Face Detection | 535B - Tavas and SaDDas |
722C - Destroying Array | 366A - Dima and Guards |
716B - Complete the Word | 1461C - Random Events |
1627A - Not Shading | 141B - Hopscotch |
47B - Coins | 1466C - Canine poetry |
74A - Room Leader | 1333D - Challenges in school №41 |
1475B - New Year's Number | 461A - Appleman and Toastman |
320B - Ping-Pong (Easy Version) | 948A - Protect Sheep |
387A - George and Sleep | 53A - Autocomplete |
1729G - Cut Substrings | 805B - 3-palindrome |
805C - Find Amir | 676C - Vasya and String |
1042B - Vitamins | 1729F - Kirei and the Linear Function |
25D - Roads not only in Berland | 1694A - Creep |