#### Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

Time Limit: 1s, Memory Limit: 32MB [Problem Description] Crud! Damian is late for a scouts camp but has yet to pack his socks. As he likes to wear matching socks, he needs K socks of the same kind. However, his socks (of N different kinds) are all in a jumble so he decides to just grab a handful of them. Furthermore, he knows that he has A_i socks of type i. How many socks does he need to grab to guarantee that he will have at least K socks of one kind? [Input] The first line contains two integers, N and K. The second line contains N space-separated integers, representing the contents of A. [Output] A single integer representing the minimum number of socks that Damian has to grab. If it is not possible for Damian to guarantee at least K socks, output -1 instead. [Subtasks] Subtask 1 (30%): 1 ≤ N ≤ 100; 0 ≤ K ≤ A_i ≤ 1000. Subtask 2 (70%): 1 ≤ N ≤ 100; 0 ≤ A_i ≤ 1000; 0 ≤ K ≤ 1000. Subtask 3 (0%): Sample Testcase. [Sample Input] 3 4 5 5 5 [Sample Output] 10

### Tags

### Subtasks and Limits

Subtask | Score | #TC | Time | Memory | Scoring |
---|---|---|---|---|---|

1 | 30 | 100 | 1s | 32MB | Minimum |

2 | 70 | 101 | 1s | 32MB | Minimum |

3 | 0 | 1 | 1s | 32MB | Minimum |

### Judge Compile Command

g++-8 ans.cpp -o socks -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512